You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Nguyen Xuan Son <ya...@gmail.com> on 2009/12/12 02:08:27 UTC

select tag problem

dear all
in JSP file i have
<s:select label="mainCategory" name="mainCategory"
       list="mainCategory" listKey="id" listValue="name"
value="%{mainCategory.{id}}" required="true" />
in struts.xml file i have
<action name="add" class="com.baibai.action.C0032_AddAction">
<result name="success">/C0031_List.jsp</result>
<result name="input">/C0032_Add.jsp</result>
</action>
in Java file i have
public List<DropDownList> getMainCategory() {
List<DropDownList> ls = null;
DropDownList dr = null;
 dr.setId(0);
dr.setName("--please select one of these--");
ls.add(dr);
 return ls;
}
but the error appear
tag 'select', field 'list', name 'mainCategory': The requested list key
'mainCategory' could not be resolved as a
collection/array/map/enumeration/iterator type. Example: people or
people.{name} - [unknown location]

do you have any suggestion

-- 
=======================================================================
Ritsumeikan University, Asia JinZai Project
Master of Information Science
Nguyen Xuan Son

Add       : Japan, Shiga-Ken, Kusatsu-Shi, Kasayama 3choume 1-18 ShiteiHaimu
Rien, Room 103
Tel/Fax  : 81-(0)90-3976 2246
Email    : nr0003xx@ed.ritsumei.ac.jp
Mobile   : 81-(0)90-3976 2246          URL  : http://www.ritsumei.jp
=======================================================================

Re: select tag problem

Posted by Paweł Wielgus <po...@gmail.com>.
Hi Nguyen,
if You would be using eclipse or idea You would have never hit such a
problem, so i encourage You to install and use one and not care about
such problems any more.
And the problem is NPE in line:
dr.setId(0);
Check your logs to see it.

Best greetings,
Pawel Wielgus.

2009/12/12, Nguyen Xuan Son <ya...@gmail.com>:
> dear all
> in JSP file i have
> <s:select label="mainCategory" name="mainCategory"
>        list="mainCategory" listKey="id" listValue="name"
> value="%{mainCategory.{id}}" required="true" />
> in struts.xml file i have
> <action name="add" class="com.baibai.action.C0032_AddAction">
> <result name="success">/C0031_List.jsp</result>
> <result name="input">/C0032_Add.jsp</result>
> </action>
> in Java file i have
> public List<DropDownList> getMainCategory() {
> List<DropDownList> ls = null;
> DropDownList dr = null;
>  dr.setId(0);
> dr.setName("--please select one of these--");
> ls.add(dr);
>  return ls;
> }
> but the error appear
> tag 'select', field 'list', name 'mainCategory': The requested list key
> 'mainCategory' could not be resolved as a
> collection/array/map/enumeration/iterator type. Example: people or
> people.{name} - [unknown location]
>
> do you have any suggestion
>
> --
> =======================================================================
> Ritsumeikan University, Asia JinZai Project
> Master of Information Science
> Nguyen Xuan Son
>
> Add       : Japan, Shiga-Ken, Kusatsu-Shi, Kasayama 3choume 1-18 ShiteiHaimu
> Rien, Room 103
> Tel/Fax  : 81-(0)90-3976 2246
> Email    : nr0003xx@ed.ritsumei.ac.jp
> Mobile   : 81-(0)90-3976 2246          URL  : http://www.ritsumei.jp
> =======================================================================
>

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