nope that's not true, they don't expect Strings

correct me if i'm wrong, but i think the problem most likely lies here:

add(new DropDownChoice("ddArtikel", new PropertyModel(artikel, "name"),
artikelList, new ChoiceRenderer("name", "id"))); 

--> the choicerenderer looks for the path "id" on the model object, which is
a string in your case (new PropertyModel(artikel, "name")), use e.g. new
Model(artikel)



Jurrie Overgoor-3 wrote:
> 
> Björn-Peter Tietjens wrote:
>> Hi all,
>> i keep getting tis strange error:*
>> WicketMessage: No get method defined for class: class java.lang.String 
>> expression: id**
>> Root cause:**
>> org.apache.wicket.WicketRuntimeException: No get method defined for 
>> class: class java.lang.String expression: id***
>>
>> when executing this line:
>> *add(new DropDownChoice("ddArtikel", new PropertyModel(artikel, 
>> "name"), artikelList, new ChoiceRenderer("name", "id")));
>>
>> *in my class Artikel the "id" property is of type long, when i chang 
>> it to String then it works...
>>
>> how do i need to do that to make it work as "long"?
> 
> I think that PropertyModels (and models in general) expect string return 
> values for the POJO's getXXX() methods.
> 
> You can try to override the getIdValue() method. Something like this:
> 
>     ChoiceRenderer c = new ChoiceRenderer("name", "id") {
>         public String getIdValue(Object object, int index) {
>             return "" + (long)object;
>         }
>     };
> 
> Note that this code is untested, and intended as explanation.
> 
> -- 
> With kind regards,
> Jurrie Overgoor
> 2go-mobile b.v.
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


-----
Michael Sparer
http://talk-on-tech.blogspot.com
-- 
View this message in context: 
http://www.nabble.com/get-method-defined-for-class-tp20357843p20358584.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to