Here's a thought experiment:

If you did a "view source" on your page what do you want to appear as the value 
in the option tag? In other words, what would be where the "XXX" is below?

<option value="XXX">A name from the list</option>

The "only" thing HTTP will send is a string. S2's type conversion can be used 
to convert the string to something else (like, say, an Integer or a Long, or 
anything else if you have appropriate type conversion in place).

This value may be *used* to instantiate an object of the desired type, but it 
will be instantiated using whatever string value is sent as the value of the 
<select...>.

The shorter answer is "you can't do that, that's not how web apps work".

Dave

--- On Wed, 6/11/08, akash agrawal <[EMAIL PROTECTED]> wrote:
> From: akash agrawal <[EMAIL PROTECTED]>
> Subject: Re: select tag list listKey and listValue usage
> To: "Struts Users Mailing List" <user@struts.apache.org>
> Date: Wednesday, June 11, 2008, 3:59 PM
> In the value attribute I am expecting to see the name (name
> is a property on my bean) and I get that correctly by
> specifying listValue="name". In the listKey, I
> would like to set the object itself instead of another
> property. 
> 
> Further when this form is submitted the whole object is set
> on the action.
> 
> Does this clarify?
> 
> Thx.
> 
> 
> --- On Wed, 6/11/08, Dave Newton
> <[EMAIL PROTECTED]> wrote:
> 
> > From: Dave Newton <[EMAIL PROTECTED]>
> > Subject: Re: select tag list listKey and listValue
> usage
> > To: "Struts Users Mailing List"
> <user@struts.apache.org>
> > Date: Wednesday, June 11, 2008, 12:52 PM
> > --- On Wed, 6/11/08, akash agrawal
> > <[EMAIL PROTECTED]> wrote:
> > > How do I populate listKey with the object itself?
> > 
> > What would that mean? What are you expecting to see in
> the
> > "value" attribute of the HTML
> <option...>
> > element?
> > 
> > Dave


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

Reply via email to