On Fri, May 09, 2008 at 11:53:30AM -0400, John Krasnay wrote:
> On Fri, May 09, 2008 at 08:25:05AM -0700, Michael Mehrle wrote:
> > Anyone? Was hoping for some input here ;-)
> > 
> > http://cwiki.apache.org/WICKET/another-dropdownchoice-example-by-adam.ht
> > ml
> > 
> > The only change I made to SelectOption is to set the 'value' field to an
> > Integer (which I need for my model).
> > 
> 
> That example is terrible. SelectOption is a Wicket component and an
> internal implementation detail of DropDownChoice. It should not be in
> your business model as the example shows.
> 
> If you're setting an integer property via a DropDownChoice, you should
> pass a List<Integer> and implement ChoiceRenderer.getDisplayValue() to
> output the right string to display.
> 
> My wild-ass guess would be that Wicket is trying to cast a SelectOption
> into an Integer, with predictable results.
> 
> jk

Ugh, I just noticed that the example has its own SelectOption class, not
the one from Wicket. But I stand by the "golden rule" of DropDownChoice:
always pass a list of the same type of object that you expect to receive
back in your business model.

jk

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

Reply via email to