struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Baldes ...@open.ch>
Subject s:select and pre-selection
Date Fri, 29 Feb 2008 08:34:16 GMT
Hi,

I have a select box:

<s:select name="user.property"
           list="availableObjects" listKey="id" listValue="name" />

"availableObjects" is a list of objects having an id and a name 
property, where id is of type "long". "user.property" is 'converted' to 
its id (as String)  by a type converter.

Now, setting user.property works well with this, but the current value 
is not pre-selected when I load the form. When I show user.property in a 
textfield, the correct ID is displayed (the id of the option which 
should be pre-selected).

I found a hint in the s:select documentation, which says that for 
OGNL-generated maps, the type of the key-attribute must be the same as 
the type of the listKey property in order to match. So I implemented 
"getIdAsString()" and used listKey="idAsString", but it doesn't work either.

What am I doing wrong here?

(I am using struts 2.0.11)

Any help or hint will be appreciated.

Thanks in advance,

Daniel

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message