You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by ryangr <gr...@gmail.com> on 2008/04/01 22:42:16 UTC
Optiontransferselect list issue
I have the following for code in my JSP:
<s:optiontransferselect
name="user.groups"
list="user.groups"
listKey="id"
listValue="title"
multiple="true"
doubleList="groups"
doubleName="groups"
doubleListKey="id"
doubleMultiple="true"
doubleListValue="title"
allowSelectAll="false"
allowUpDownOnLeft="false"
allowUpDownOnRight="false"
/>
In my action I have a "groups" variable that is an extended ArrayList and a
user variable that contains an extended ArrayList also named "groups". Both
"groups" variables are of the same type GroupList that is my own custom
type, although it's really just a simple extension of ArrayList.
With that being said...I can populate the list "groups" just fine, but when
I try to use "user.groups" to get the other list it throws an exception that
says: "The requested list key 'user.groups' could not be resolved as a
collection/array/map/enumeration/iterator type." What am I doing wrong? It's
probably pretty obvious, but this hasn't exactly been a good week for
concentration so far. ;)
--
View this message in context: http://www.nabble.com/Optiontransferselect-list-issue-tp16424054p16424054.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Optiontransferselect list issue
Posted by Ryan <gr...@gmail.com>.
Well, I got it working...thanks for the sanity check, Laurie! The
user.groups collection was not getting assigned appropriately at the bottom
of a long, dark path of assignment logic. I suppose a null collection really
isn't technically a collection, hence the exception error message, but the
message could have been a little less obtuse. Apparently null variables
really are useless! </sarcasm> :)
-Ryan
On 4/2/08, Laurie Harper <la...@holoweb.net> wrote:
>
> Have you double-checked that getUser().getGroups() is returning what it
> should be? I.e. getUser() is not returning null; getUser().getGroups() is
> really returning a collection? As a sanity check, what happens if you
> include the following in your JSP:
>
> user:
> <s:property value="user"/>
> <s:property value="getUser()"/>
>
> user.groups:
> <s:property value="user.groups"/>
> <s:property value="getUser().getGroups()"/>
>
> L.
>
> ryangr wrote:
>
> > Are you just missing the getter for user? Struts2 has to call
> > > getUser().getGroups().
> > >
> >
> > The action has getters and setters for both user and groups, and the
> > user
> > object has a getter/setter for its groups attribute.
> >
> > I never have these two attributes pointing to the same property. It
> > > may work, but it's the first place I'd look for type conversion problems.
> > > My list attribute always points to a List with key and value entries
> > > for the select and the name attribute always points to a String[] that will
> > > contain the selected key values.
> > >
> >
> > Thanks for the pointer on that, I was wondering what the difference
> > between
> > them was; however, I don't think that is quite the issue in this case
> > (yet).
> > Taking your advice on having a String[] for the name attribute, I can do
> > an
> > <s:updownselect list="groups" name="groupKeys" /> and that collection
> > displays its data, but when I have <s:updownselect list="user.groups"
> > name="groupKeys" /> the JSP throws the same exception as the
> > <s:optiontransferselect> snippet that is causing headaches.
> >
> > Apr 2, 2008 10:33:18 AM org.apache.catalina.core.ApplicationDispatcher
> > invoke
> > SEVERE: Servlet.service() for servlet jsp threw exception
> > tag 'updownselect', field 'list': The requested list key 'user.groups'
> > could
> > not be resolved as a collection/array/map/enumeration/iterator type.
> > Example: people or people.{name} - [unknown location]
> >
> > It is baffling me at this point because they are the same data type, and
> > getters/setters exist for all the related objects... *scratches head*
> >
> > -Ryan
> >
> >
> > Jeromy Evans - Blue Sky Minds wrote:
> >
> > > ryangr wrote:
> > >
> > > With that being said...I can populate the list "groups" just fine,
> > > > but
> > > > when
> > > > I try to use "user.groups" to get the other list it throws an
> > > > exception
> > > > that
> > > > says: "The requested list key 'user.groups' could not be resolved as
> > > > a
> > > > collection/array/map/enumeration/iterator type." What am I doing
> > > > wrong?
> > > > It's
> > > > probably pretty obvious, but this hasn't exactly been a good week
> > > > for
> > > > concentration so far. ;)
> > > >
> > > >
> > > Are you just missing the getter for user? Struts2 has to call
> > > getUser().getGroups().
> > >
> > >
> > > I have the following for code in my JSP:
> > > >
> > > > <s:optiontransferselect
> > > > name="user.groups"
> > > >
> > > > list="user.groups"
> > > >
> > > I never have these two attributes pointing to the same property. It
> > > may work, but it's the first place I'd look for type conversion problems.
> > > My list attribute always points to a List with key and value entries
> > > for the select and the name attribute always points to a String[] that will
> > > contain the selected key values.
> > >
> > >
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > 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: Optiontransferselect list issue
Posted by Laurie Harper <la...@holoweb.net>.
Have you double-checked that getUser().getGroups() is returning what it
should be? I.e. getUser() is not returning null; getUser().getGroups()
is really returning a collection? As a sanity check, what happens if you
include the following in your JSP:
user:
<s:property value="user"/>
<s:property value="getUser()"/>
user.groups:
<s:property value="user.groups"/>
<s:property value="getUser().getGroups()"/>
L.
ryangr wrote:
>> Are you just missing the getter for user? Struts2 has to call
>> getUser().getGroups().
>
> The action has getters and setters for both user and groups, and the user
> object has a getter/setter for its groups attribute.
>
>> I never have these two attributes pointing to the same property. It may
>> work, but it's the first place I'd look for type conversion problems.
>> My list attribute always points to a List with key and value entries for
>> the select and the name attribute always points to a String[] that will
>> contain the selected key values.
>
> Thanks for the pointer on that, I was wondering what the difference between
> them was; however, I don't think that is quite the issue in this case (yet).
>
> Taking your advice on having a String[] for the name attribute, I can do an
> <s:updownselect list="groups" name="groupKeys" /> and that collection
> displays its data, but when I have <s:updownselect list="user.groups"
> name="groupKeys" /> the JSP throws the same exception as the
> <s:optiontransferselect> snippet that is causing headaches.
>
> Apr 2, 2008 10:33:18 AM org.apache.catalina.core.ApplicationDispatcher
> invoke
> SEVERE: Servlet.service() for servlet jsp threw exception
> tag 'updownselect', field 'list': The requested list key 'user.groups' could
> not be resolved as a collection/array/map/enumeration/iterator type.
> Example: people or people.{name} - [unknown location]
>
> It is baffling me at this point because they are the same data type, and
> getters/setters exist for all the related objects... *scratches head*
>
> -Ryan
>
>
> Jeromy Evans - Blue Sky Minds wrote:
>> ryangr wrote:
>>
>>> With that being said...I can populate the list "groups" just fine, but
>>> when
>>> I try to use "user.groups" to get the other list it throws an exception
>>> that
>>> says: "The requested list key 'user.groups' could not be resolved as a
>>> collection/array/map/enumeration/iterator type." What am I doing wrong?
>>> It's
>>> probably pretty obvious, but this hasn't exactly been a good week for
>>> concentration so far. ;)
>>>
>> Are you just missing the getter for user? Struts2 has to call
>> getUser().getGroups().
>>
>>
>>> I have the following for code in my JSP:
>>>
>>> <s:optiontransferselect
>>> name="user.groups"
>>> list="user.groups"
>> I never have these two attributes pointing to the same property. It may
>> work, but it's the first place I'd look for type conversion problems.
>> My list attribute always points to a List with key and value entries for
>> the select and the name attribute always points to a String[] that will
>> contain the selected key values.
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> 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: Optiontransferselect list issue
Posted by ryangr <gr...@gmail.com>.
> Are you just missing the getter for user? Struts2 has to call
> getUser().getGroups().
The action has getters and setters for both user and groups, and the user
object has a getter/setter for its groups attribute.
> I never have these two attributes pointing to the same property. It may
> work, but it's the first place I'd look for type conversion problems.
> My list attribute always points to a List with key and value entries for
> the select and the name attribute always points to a String[] that will
> contain the selected key values.
Thanks for the pointer on that, I was wondering what the difference between
them was; however, I don't think that is quite the issue in this case (yet).
Taking your advice on having a String[] for the name attribute, I can do an
<s:updownselect list="groups" name="groupKeys" /> and that collection
displays its data, but when I have <s:updownselect list="user.groups"
name="groupKeys" /> the JSP throws the same exception as the
<s:optiontransferselect> snippet that is causing headaches.
Apr 2, 2008 10:33:18 AM org.apache.catalina.core.ApplicationDispatcher
invoke
SEVERE: Servlet.service() for servlet jsp threw exception
tag 'updownselect', field 'list': The requested list key 'user.groups' could
not be resolved as a collection/array/map/enumeration/iterator type.
Example: people or people.{name} - [unknown location]
It is baffling me at this point because they are the same data type, and
getters/setters exist for all the related objects... *scratches head*
-Ryan
Jeromy Evans - Blue Sky Minds wrote:
>
> ryangr wrote:
>
>> With that being said...I can populate the list "groups" just fine, but
>> when
>> I try to use "user.groups" to get the other list it throws an exception
>> that
>> says: "The requested list key 'user.groups' could not be resolved as a
>> collection/array/map/enumeration/iterator type." What am I doing wrong?
>> It's
>> probably pretty obvious, but this hasn't exactly been a good week for
>> concentration so far. ;)
>>
>
> Are you just missing the getter for user? Struts2 has to call
> getUser().getGroups().
>
>
>> I have the following for code in my JSP:
>>
>> <s:optiontransferselect
>> name="user.groups"
>> list="user.groups"
>
> I never have these two attributes pointing to the same property. It may
> work, but it's the first place I'd look for type conversion problems.
> My list attribute always points to a List with key and value entries for
> the select and the name attribute always points to a String[] that will
> contain the selected key values.
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/Optiontransferselect-list-issue-tp16424054p16447314.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Optiontransferselect list issue
Posted by Jeromy Evans <je...@blueskyminds.com.au>.
ryangr wrote:
> With that being said...I can populate the list "groups" just fine, but when
> I try to use "user.groups" to get the other list it throws an exception that
> says: "The requested list key 'user.groups' could not be resolved as a
> collection/array/map/enumeration/iterator type." What am I doing wrong? It's
> probably pretty obvious, but this hasn't exactly been a good week for
> concentration so far. ;)
>
Are you just missing the getter for user? Struts2 has to call
getUser().getGroups().
> I have the following for code in my JSP:
>
> <s:optiontransferselect
> name="user.groups"
> list="user.groups"
I never have these two attributes pointing to the same property. It may
work, but it's the first place I'd look for type conversion problems.
My list attribute always points to a List with key and value entries for
the select and the name attribute always points to a String[] that will
contain the selected key values.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org