java - Apache wicket - DropDownChioce.onSelectionChanged() does not work -


I have recently started using the wicket. In my example of the project, I tried to use the "Apache wicket by Weberberg" book in the linked selection box.

I created an example from this book:

  Public class LinkedSelectboxesPage webpage [Private country country; Private city city; Public Linked Boxes (page) {Database.buildData (); Country = Database .getcountries (). Get (0); FeedbackPackel FeedbackPanel = New FeedbackPackel ("Feedback"); Adding (feedbackPanel); Form form = new form ("form"); (Form) add; DropDownChoice & LT; Country & gt; Change (change name), "country", "new country", "new country"); {back true; country (new name "," code ") (" name "," code ") (protected boolean want changeable change notification (new name) } Secure on zero selected (country's new selection) {city = null;}}; countries.setRequired (correct); form.add (countries); DropDownChoice & lt; city & gt; city = new dropdown choice & lt; city ("Cities", New Property Model ATC; City & gt; (this, "City"), New CitiesModel (), New Option Renderer & lt; City & gt; ("Name", "Code")) ; Cities.setRequired (correct); form.add (city);} G Static class country model to be loadedDatableModel & lt; list & lt; country extension & gt; & gt; {safe list & lt; country extension & gt; load () {return Database.getCountries ();} } Private class CitiesModel Loadable Databases & lt; List & lt;? City Expansion & gt; & gt; {Safe List & lt;? City & gt; Spread Load () {return Database.getCode (country.getCode ( ));}}}   

When I try to use the associated pick-box in my project, breakpoints, Connection is settled in front of the body, has not been received.

  spreads to the public category AddArticlePanel panel {Private type type; Private subtype subtype; Private listing & lt; Type & gt; TypesList; Private listing & lt; Subtype & gt; SubtypesList; @SpringBean @SuppressWarnings ("unused") public static ITypeDao type Dao; @SpringBean @SuppressWarnings ("unused") Dao private ISubipedo subtype; Public AddArticlePanel {String ID} {Super (ID); This.typesList = typeDao.loadAllTypes (); This.Type = this.typesList.get (0); Form form = new form ("form"); (Form) add; FormComponent & LT; String & gt; TbTitleArticle = new textfield & lt; String & gt; ("TitleArticle"). SetRequired (true); Form.add (tbTitleArticle); FormComponent & LT; String & gt; TaTextArticle = new textile & lt; String & gt; ("TextArticle"). Set-radiare (true); Form.add (taTextArticle); DropDownChoice & LT; Type & gt; ("Name", "id")) {Protected boolean want secretary to change the notification (new type), type (new type of model), type type (this, "type"), new typemodel (), new Option Renderer & lt; Type & gt; } {Back true; } Secure zero selected option (type new selection) {type = null; }}; DdcTypes.setRequired (true); Form.add (ddcTypes); DropDownChoice & LT; Subtype & gt; DdcSubtypes = new DropDownChoice & lt; Subtype & gt; ("Subtype Article", New PropertyModel  (this, "Subtype"), New Subtipes Model (), New Option Renderer  ("name", "id")); DdcSubtypes.setRequired (true); Form.add (ddcSubtypes); } Public AddArticlePanel (string id, emodel & lt ;? & gt; model) {super (id, model); } Private Static Class Type Model Loadable Dataset Model & lt; List & lt;? Type & gt; & Gt; {Secure list & lt;? Type & gt; Load () {return type Dao.loadAllTypes (); }} Private class subtype model loadable Dottable Model & lt; List & lt;? Subtype & gt; & Gt; {Secure list & lt;? Subtype and GT; Load () {return subtypeDao.loadSubtypesByTypeId (type.getId ()); }}}   

I do not understand why this happened. Please help me, sorry for my english and

In your on-change method, you set the type to clear. This is the member who is an example of the model of your required dropdown Choice field DDCTap, which is in contrast to the example from that book, where country-DDC resets on-changergic mode, the city variables

In your case you reset each and every change type of tap, thus your form has been invalidated and prevent it from doing anything useful < / Html>

Comments