struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Rodriguez Lopez <alo...@flordeutopia.pt>
Subject Re: How to get s:select id and name under struts2 action?
Date Tue, 23 Mar 2010 09:36:30 GMT
Forgot to mention, this is the case with a multiple select, if the 
select is simple and only one option can be selected, then a bean 
property for an int or long will sufice.

Em 23-03-2010 09:33, Alex Rodriguez Lopez escreveu:
> Assuming your ids are of type long, you could do it with a list of Long
> like so in your action:
>
> private List<Long> test = new ArrayList<Long>();
>
> plus the getters and setters (getTest(), setTest()).
>
> test is the name you gave in the select (<s:select name="test" ... />).
> Struts2 will polulate the list with the selected ids.
>
> Em 23-03-2010 02:43, red phoenix escreveu:
>> I have a jsp,it contains a s:select,like follows:
>> <s:select name="test" list="#request.testList" listKey="id"
>> listValue="tname" size="6" cssClass="tbcell"/>
>>
>> When this jsp submit,it will submit to a struts2 action,I want to know
>> how
>> to get all id and name of s:select and how to get selected id and name of
>> s:select ?
>> How to do it? An example is better.
>>
>> Thanks!
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>


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


Mime
View raw message