You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by red phoenix <ro...@gmail.com> on 2010/03/23 03:43:03 UTC

How to get s:select id and name under struts2 action?

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!

Struts Action not getting initialised.

Posted by VR Venugopal Rao <ve...@cmcltd.com>.
I have mentioned the action configuration in web.xml but struts Action is
not getting initialized.
I have placed the jar file in the classpath also which is in lib folder.

Where is the problem.

Regards, 
VR Venugopal Rao 


-----Original Message-----
From: Alex Rodriguez Lopez [mailto:alopez@flordeutopia.pt] 
Sent: 23 March 2010 15:07
To: Struts Users Mailing List
Subject: Re: How to get s:select id and name under struts2 action?

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


______________________________________________________________________________

DISCLAIMER

The information contained in this e-mail message and/or attachments to it may
contain confidential or privileged information. If you are not the intended
recipient, any dissemination, use, review, distribution, printing or copying
of the information contained in this e-mail message and/or attachments to it
are strictly prohibited. If you have received this communication in error,
please notify us by reply e-mail or directly to netsupport@cmcltd.com or
telephone and immediately and permanently delete the message and any
attachments. Thank you.


______________________________________________________________________________

This email has been scrubbed for your protection by SecureMX.
For more information visit http://securemx.in
______________________________________________________________________________


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


Re: How to get s:select id and name under struts2 action?

Posted by Alex Rodriguez Lopez <al...@flordeutopia.pt>.
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


Re: How to get s:select id and name under struts2 action?

Posted by Alex Rodriguez Lopez <al...@flordeutopia.pt>.
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