我有国家/地区的 wicket-select2 下拉菜单。
Select2Choice<Country> country = new Select2Choice<Country>("country", new PropertyModel<Country>(params, "selectedCountry"),new CountriesProvider(params));
单击添加国家按钮后使用 popupPanel 添加新国家,以下是功能。
Country addCountry = new Country();
//provide data of country for setter and add in db and setting countrydropdown Model Object by using below code:
country.setModelObject(addCountry);
param.setCountry(countrylistUpdated);
country.setprovider(new CountryProvider);
target.add(addCountry);
页面被重定向到主页,但我收到以下错误
org.apache.wicket.WicketRuntimeException: Exception in rendering component: [DropDownChoice [Component id = qualityDropDown]]
at org.apache.wicket.Component.internalRenderComponent(Component.java:2589)
at org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1698)
at org.apache.wicket.Component.internalRender(Component.java:2380)
at org.apache.wicket.Component.render(Component.java:2308)
at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1524)
at org.apache.wicket.MarkupContainer.renderAll(MarkupContainer.java:1759)
at org.apache.wicket.MarkupContainer.renderComponentTagBody(MarkupContainer.java:1734)
at org.apache.wicket.MarkupContainer.onComponentTagBody(MarkupContainer.java:1657)
........
//some more logs...
......
Caused by: java.lang.NullPointerException: List of choices is null - Was the supplied 'Choices' model empty?
at org.apache.wicket.markup.html.form.AbstractChoice.getChoices(AbstractChoice.java:233)
at org.apache.wicket.markup.html.form.AbstractChoice.onComponentTagBody(AbstractChoice.java:376)
at org.apache.wicket.markup.html.panel.DefaultMarkupSourcingStrategy.onComponentTagBody(DefaultMarkupSourcingStrategy.java:70)
at org.apache.wicket.Component.internalRenderComponent(Component.java:2565)
... 103 more
而如果我选择任何国家然后单击添加按钮并保存新国家然后它会在下拉列表中显示新添加的国家。