I have a select that populates with a int,string id/value combo.  To
get the s:select to select the proper option I had to crate another
value in my action (int myId).  This would be set to the id of the
option to select.  Then I had to set the name attribute of my select
to myId (name="myId").

On Fri, Feb 29, 2008 at 5:04 AM, Daniel Baldes <[EMAIL PROTECTED]> wrote:
> 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: [EMAIL PROTECTED]
>  For additional commands, e-mail: [EMAIL PROTECTED]
>
>

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

Reply via email to