Be careful - that code is becoming very messy. It's better to http://cwiki.apache.org/WICKET/working-with-wicket-models.html read about how to use models rather than invent adhoc and unorthodox methods like getDevices() that returns one device (rather than a collection containing 0, 1 or more devices) just so you can make this work.
For your case/code read about CompoundPropertyModel - you have not given your DDC a model so it is looking up the (containment) hierarchy for a CompoundPropertyModel and it will try to bind to a "devices" property on that CompoundPropertyModel's object). Regards - Cemal http://www.jWeekend.com jWeekend itayke wrote: > > Hi, > > Seem like the problem is solved by adding a "Device" class member and > these getter and setter to the FormInput class: > > public Device getDevices(){ > return new Device(); > } > > > public void setDevices(Device d){ > device = d; > } > > > thanks for your help. > > > > > > Alex Objelean wrote: >> >> >> Wicket expects that FormInput would have a getter for devices. This >> happens because you are using CompoundPropertyModel with your >> form....thus the wicket id is automatically used as a propertyModel on >> the form model object. >> >> Alex Objelean >> >> >> itayke wrote: >>> >>> Hi, >>> >>> I have this problem with my dropdownchoice with results in >>> WicketMessage: No get method defined for class: class >>> screens.CustomerFilters$FormInput expression: devices >>> >>> were the java class has: >>> >>> public CustomerFilters(){ >>> super(); >>> FormInput formInput = new FormInput("Form"); >>> setModel(new CompoundPropertyModel(formInput)); >>> add(formInput); >>> ...... >>> >>> } >>> >>> >>> and the form class: >>> >>> public class FormInput extends Form{ >>> >>> String deviceID; >>> >>> public FormInput(String id) { >>> super(id); >>> >>> DropDownChoice ddc = >>> new DropDownChoice("devices", >>> getDevicesList(), //this will >>> return a list of Device POJOs >>> new IChoiceRenderer() { >>> public Object getDisplayValue(Object >>> object) { >>> return >>> ((Device)object).getDeviceName(); >>> } >>> public String getIdValue(Object object, >>> int index) { >>> return >>> ((Device)object).getDeviceID(); >>> } >>> }); >>> >>> add(ddc); >>> } >>> >>> I also have a simple "Device" POJO class with getters and setters. >>> The HTML looks like that: >>> >>> ... >>> <form wicket:id="Form"> >>> <table> >>> <tr> >>> <th>Select Device</th> >>> <td><select wicket:id="devices"> >>> <option>Some device</option> >>> </select> >>> </td> >>> </tr> >>> <tr><td colspan="2"><input type="submit" value="submit"/></td></tr> >>> </table> >>> </form> >>> >>> ... >>> >>> >>> >>> Any ideas what i'm doing wrong? >>> >>> >> >> > > -- View this message in context: http://www.nabble.com/problem-with-dropdownchoice-tp21563513p21565122.html Sent from the Wicket - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org