You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by mabel25 <ma...@hotmail.com> on 2008/07/09 08:25:57 UTC

unable to set object for dropdownchoice

Hi, 

i have the following codes for a dropdownchoice component. 


List<String> isUserGender = Arrays.asList("M","F"); 
gender = new DropDownChoice("gender", new PropertyModel(User,"UserGender"),
isUserGender); 
                  
List<String> isUserDesignation = Arrays.asList("Operator","Custom officer",
"Warehouse Supervisor", "Top Management"); 
designa = new DropDownChoice ("design", new PropertyModel
(User,"UserDesignation"), isUserDesignation); 


However, i encounterd the following error: 

WicketMessage: unable to set object Top Management 
Root cause: 

wicket.WicketRuntimeException: no set method defined for value: Top
Management on object:

This error disappear after I ran the application a few times but it comes
back again after several tries. 

Anyone knows how to solve this? thanks 

-- 
View this message in context: http://www.nabble.com/unable-to-set-object-for-dropdownchoice-tp18355243p18355243.html
Sent from the Wicket - Dev mailing list archive at Nabble.com.


Re: unable to set object for dropdownchoice

Posted by jWeekend <jw...@cabouge.com>.
"User" should be a reference to an object that has a field called
UserDesignation (bad naming, see below).
If you are using 1.3 or newer, this can be private. You can also declare a
setter, but the capitalisation will most likely confuse you and Wicket. 
The choice of identifier names is in fact more than confusing (the
capitalisation is wrong, an 'is' prefix usually suggests 'boolean'ness ...),
which doesn't help you solve this problem. Worse, it conflicts with the
JavaBeans naming conventions expected by the PropertyModel.

User should be user
UserDesignation should be userDesignation
isUserDesignation should preferably be something like userDesignations 
etc ...

Regards - Cemal
http://jWeekend.co.uk http://jWeekend.co.uk 





mabel25 wrote:
> 
> Hi, 
> 
> i have the following codes for a dropdownchoice component. 
> 
> 
> List<String> isUserGender = Arrays.asList("M","F"); 
> gender = new DropDownChoice("gender", new
> PropertyModel(User,"UserGender"), isUserGender); 
>                   
> List<String> isUserDesignation = Arrays.asList("Operator","Custom
> officer", "Warehouse Supervisor", "Top Management"); 
> designa = new DropDownChoice ("design", new PropertyModel
> (User,"UserDesignation"), isUserDesignation); 
> 
> 
> However, i encounterd the following error: 
> 
> WicketMessage: unable to set object Top Management 
> Root cause: 
> 
> wicket.WicketRuntimeException: no set method defined for value: Top
> Management on object:
> 
> This error disappear after I ran the application a few times but it comes
> back again after several tries. 
> 
> Anyone knows how to solve this? thanks 
> 
> 

-- 
View this message in context: http://www.nabble.com/unable-to-set-object-for-dropdownchoice-tp18355243p18525156.html
Sent from the Wicket - Dev mailing list archive at Nabble.com.


Re: unable to set object for dropdownchoice

Posted by Nino Saturnino Martinez Vazquez Wael <ni...@jayway.dk>.
Hmm

Something seems wrong with your code or youre not providing it all. 
Could you create a quickstart? (simple project created with the wicket 
archetype, that only contains your core problem..)

mabel25 wrote:
> Hi, 
>
> i have the following codes for a dropdownchoice component. 
>
>
> List<String> isUserGender = Arrays.asList("M","F"); 
> gender = new DropDownChoice("gender", new PropertyModel(User,"UserGender"),
> isUserGender); 
>                   
> List<String> isUserDesignation = Arrays.asList("Operator","Custom officer",
> "Warehouse Supervisor", "Top Management"); 
> designa = new DropDownChoice ("design", new PropertyModel
> (User,"UserDesignation"), isUserDesignation); 
>
>
> However, i encounterd the following error: 
>
> WicketMessage: unable to set object Top Management 
> Root cause: 
>
> wicket.WicketRuntimeException: no set method defined for value: Top
> Management on object:
>
> This error disappear after I ran the application a few times but it comes
> back again after several tries. 
>
> Anyone knows how to solve this? thanks 
>
>   

-- 
-Wicket for love

Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684