Thursday, 15 January 2015

java - Wicket AutoCompleteTextField model casting -


It seems that the model object of autocompletetextfield is a string, even if it should be an employee, not the exception. What is the ability to enter from the string to the employee? And how can it be decided?

  Final DefaultCssAutocompleteTextField & lt; Employee & gt; Field = new DefaultCssAutocompleteTextField & lt; Employee & gt; ("Field", new model & employee; employee & gt; (model.getObject (). GetMatch (). GetSupervisor ())) {@Override Protected Iterator & lt; Employee & gt; GetChoices (string input) {if (strings.ISEP) {list & lt; Employee & gt; Empty List = Archive. Return empty.dump (); } Return supervisor.gateautococcalCappleSuperizer (Input, 6). Director (); }}; Form.add (area); Field.add (new AjaxFormsSubmitBraviverse (form, "onchange") {@Override protected void onSubmit (AjaxRequestTarget Goal) {// it generates an exception: string is inserted from the employee, why? And how it can be fixed Employee E = SupervisorService.findOne (field.getModelObject). GetId (); / Some stuff with employee and some components} @ Override error on protected void (AjaxRequestTarget target) {// nothing}}); Javadoc  AutoCompleteTextfield  of    

IConverter to convert the input back to non-string type, either override #getConverter (Class) or by setting An appropriate IConverter on the ConverterLocator of the application.

No comments:

Post a Comment