You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jim Collings <jl...@gmail.com> on 2009/07/01 16:02:23 UTC

Multiselect tags

So I went searching in the archives for how to use a select tag with
multiselect='true' set.
I found one entry from 2007 where a user asks this question. The
answer was "Use a list".

Great.

How?  If I set the tag to a list of objects specified in my action,
how do I set the second list of objects? Will they be Strings or if I
set my select tag to key off of 'recordId' which is an integer, will
it be a list of integers?

I would like to request documentation for the select tag be updated to
reflect a simple example.


Jim C.

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


Re: Multiselect tags

Posted by Jim Collings <jl...@gmail.com>.
OK, so it is really a lot simpler than I thought. Just have to set the
name of the select to the name of the property and the system will
figure out that it is a list of what ever the listkey is set to. Same
as usual.

On Wed, Jul 1, 2009 at 12:11 PM, Jim Collings<jl...@gmail.com> wrote:
>> One way to implement:
>> Create a class, CascDropDown, with getters and setters for value, label and
>> subList.
>> subList is a List of objects, DropDown, with getters and setters for value
>
> This is not what I was having trouble with.
>
> Anyway, I've got the solution but I need to complete what I am working
> on before I post it. :-)
>
> Jim C.
>

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


Re: Multiselect tags

Posted by Jim Collings <jl...@gmail.com>.
> One way to implement:
> Create a class, CascDropDown, with getters and setters for value, label and
> subList.
> subList is a List of objects, DropDown, with getters and setters for value

This is not what I was having trouble with.

Anyway, I've got the solution but I need to complete what I am working
on before I post it. :-)

Jim C.

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


RE: Multiselect tags

Posted by Lee Clemens <ja...@leeclemens.net>.
If you are trying to make a cascading drop down, you can do so with the
doubleselect tag.

One way to implement:
Create a class, CascDropDown, with getters and setters for value, label and
subList.
subList is a List of objects, DropDown, with getters and setters for value
and label.

If you have values A, B in the first dropdown and want to show 1, 2, 3 when
A is selected and 10, 11, 12 if B is selected:

Create List of DropDown objects from above with value/labels of 1, 2 and 3 -
then add the List to the CascDropDown object and set the value/label to "A".

Do the same with 10, 11, 12 as the subList and the value/label set to "B"

Add those two CascDropDown objects to a list, called myCascDropDown, and put
a getter in your action.

<s:doubleselect name="formAttrib0" doubleName="forAttrib1"
                        list=" myCascDropDown" doubleList="subList"
                        listKey="value" doubleListKey="value"
                        listValue="label" doubleListValue="label"/>

When you select "A" - "1", "2" and "3" should appear in the second dropdown.


-----Original Message-----
From: Jim Collings [mailto:jlistnews@gmail.com] 
Sent: Wednesday, July 01, 2009 10:34 AM
To: Struts Users Mailing List
Subject: Re: Multiselect tags

So I tried setting key='selectedList'

This did not work. I got a null selectedList and:

ognl.ExpressionSyntaxException: Malformed OGNL expression:
[ognl.ParseException: Encountered "<EOF>" at line 1, column 0.
Was expecting one of:
.
.
.
etc.

> How?  If I set the tag to a list of objects specified in my action,
> how do I set the second list of objects? Will they be Strings or if I
> set my select tag to key off of 'recordId' which is an integer, will
> it be a list of integers?
>
> I would like to request documentation for the select tag be updated to
> reflect a simple example.

---------------------------------------------------------------------
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: Multiselect tags

Posted by Jim Collings <jl...@gmail.com>.
So I tried setting key='selectedList'

This did not work. I got a null selectedList and:

ognl.ExpressionSyntaxException: Malformed OGNL expression:
[ognl.ParseException: Encountered "<EOF>" at line 1, column 0.
Was expecting one of:
.
.
.
etc.

> How?  If I set the tag to a list of objects specified in my action,
> how do I set the second list of objects? Will they be Strings or if I
> set my select tag to key off of 'recordId' which is an integer, will
> it be a list of integers?
>
> I would like to request documentation for the select tag be updated to
> reflect a simple example.

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