Try with @Override public String getIdValue(Object array, int arg1) { return Integer.toString(arg1); }
On Thu, 2010-05-06 at 15:44 -0400, Brian Mulholland wrote: > This is a second asking, so sorry if I am being impatient, but I was > hoping to see a response to this. > > I've got a combo box with the list in a List of string arrays (code > and decode). The bean has the currently selected code. I created a > DropDownChoice with a custom ChoceRenderer as below. The CR interface > is invoked for both the acquisition of the bean value and for each row > of the list, which is why the below code checks the type of object > coming in. > > This works great when displaying, but when the value comes back to the > server, it is loaded back into the bean as > "[Ljava.lang.String;@3c6f3c6f". It looks like the Object.toString(). > What am I doing wrong here? > > DropDownChoice ddc = new DropDownChoice(id, new PropertyModel(bean, > id), listOfStringArrays, new IChoiceRenderer(){ > @Override > public Object getDisplayValue(Object array) { > if(array instanceof String) > return (String) array; > else if(array.getClass().isArray()){ > String[] result = (String[]) array; > return result[1]; > } > else > throw new RuntimeException("Huh?"); > } > > @Override > public String getIdValue(Object array, int arg1) { > if(array instanceof String) > return (String) array; > else if(array.getClass().isArray()) > { > String[] result = (String[]) array; > return result[0]; > } > else > throw new RuntimeException("Huh?"); > } > }); > > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org