There is built in data conversion, but you have to create your own data
converter.

Struts could't automaticaly find your State from the id since it knows
nothing a about your persiatance layer.  So you will have to look it up in
the converter.  For some as simple as the State object you have, you could
post "name~id" as the select value and then parse it in the converter to
populate your Object.


Look up type conversion in the docs for what class to extend an how to
register the converter.
-D


Oleg-16 wrote:
> 
> Was wondering if struts built-in data conversion will work to receive
> an object from select list. So, if select list populated with
> List<State> stateList and the variable submitted from s:select is a
> State object, is it possible to actually get this object in the
> receiving action?
> 
> so if:
> 
> State state;
> 
> State {
> int id;
> String name;
> }
> 
> and
> 
> <s:select name="state" list='stateList' listValue="name" listKey="id" />
> 
> Any way to have struts 2 make the conversion so I don't to manually
> look up the State object via submitted key?
> 
> Thanks a lot, Oleg
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/-S2--submitting-object-from-%3Cs%3Aselect%3E-tp20740878p20742159.html
Sent from the Struts - User mailing list archive at Nabble.com.


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

Reply via email to