You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Mead Lai <la...@gmail.com> on 2008/11/12 02:19:21 UTC

Re: Struts2: Getting multiple values from tag

Where the <s:select> tag will render to HTML,
whatever you do in struts2-Tag, the HTML <select> just only pass the value
in <select>.
so, it seems no good idea.
I do it like this:

<s:select  list="listCollection" listKey="displayValue"
listValue="name+'separatorString'+anotherValue+'sepStr2'+id">

"name,anotherValue,id" is the value you need.

join the string value which you wanne get, and separator them with
"separatorString",
then put it in the listValue.
you shall parse the string you get at the serve side.

On Wed, Nov 12, 2008 at 2:37 AM, Peterson, Ryan
<Ry...@mckesson.com>wrote:

> Hey guys,
>
> I'm using custom objects to store attributes (say a person with
> first/last name, age, height).  Right now I have a collection that
> stores these objects, and then displays them on a JSP page for the user
> to select one from the collection for further processing like so:
>
>
>
> <s:iterator value="peopleCollection">
>
> <li>
>
> <a href=" <s:url action="ProcessPersonSelection">
>
>                        <s:param name="firstName" value="firstName" />
>
>                        <s:param name="age" value="age" />
>
>                        <s:param name="height" value="height" />
>
>            </s:url>">
>
>            <s:property value="lastName" />
>
>            </a>
>
>            </li>
>
> </s:iterator>
>
>
>
> What this does is sets up a list of links, which display the last name
> of the person object, and when clicked submits all the params specified
> (firstName, age, height, lastName).
>
>
>
> The downside is I can't use the <s:token /> tag, because it's not in
> proper "form" tags.  All of the <s:select> or <s:radio> tags allow
> nearly the same functionality, except only 1 value can be returned,
> rather than all of the values.  Is there another way to get multiple
> values submitted from select or radio tags?
>
>
> Any help is appreciated!
>
>


-- 
BestRegards,
Mead
http://yayisoft.com

Tallulah Bankhead  - "If I had to live my life again, I'd make the same
mistakes, only sooner."