You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Kalcevich, Daniel" <dk...@firstam.com> on 2006/04/17 22:39:12 UTC
ArrayList & html:options
Everyone,
I am trying to use the htm-el:options tag to write out the value of a
Select box. I am using an ArrayList of Strings that I am trying to
iterate over. I want the value and option to be the same on the output.
Here is how I am calling my code...
Action:
request.setAttribute( "exportDates", exportDates ); //exportDates =
ArrayList<String>
JSP:
<html-el:select property="exportDate">
<html-el:options collection="${exportDates}" />
</html-el:select>
Error:
15:38:53,106 ERROR [action]:253 - Servlet.service() for servlet action
threw exception
javax.servlet.jsp.JspException: ServletException in
'/jsp/templates/tab_content_template.jsp': ServletException in
'/jsp/fine_export.jsp': Cannot find bean under name [04/17/2006,
04/16/2006]
at
org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(InsertTa
g.java:923)
at
org.apache.struts.taglib.tiles.InsertTag.doEndTag(InsertTag.java:462)
at
org.apache.jsp.jsp.templates.main_005ftemplate_jsp._jspx_meth_tiles_inse
rt_1(org.apache.jsp.jsp.templates.main_005ftemplate_jsp:160)
at
org.apache.jsp.jsp.templates.main_005ftemplate_jsp._jspService(org.apach
e.jsp.jsp.templates.main_005ftemplate_jsp:88)
at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
Any ideas would be greatly appreciated. Thanks.
Daniel
Re: ArrayList & html:options
Posted by Wendy Smoak <ws...@gmail.com>.
On 4/17/06, Kalcevich, Daniel <dk...@firstam.com> wrote:
> request.setAttribute( "exportDates", exportDates ); //exportDates =
> ArrayList<String>
>
> JSP:
>
> <html-el:select property="exportDate">
> <html-el:options collection="${exportDates}" />
> </html-el:select>
>
> Error:
> 15:38:53,106 ERROR [action]:253 - Servlet.service() for servlet action
> threw exception
> javax.servlet.jsp.JspException: ServletException in
> '/jsp/templates/tab_content_template.jsp': ServletException in
> '/jsp/fine_export.jsp': Cannot find bean under name [04/17/2006,
> 04/16/2006]
You don't need the expression in the 'collection' attribute. It wants
the _name_ of the bean. You can see from the error message that the
String representation of the ArrayList is getting passed into the tag.
Try using just:
<html-el:options collection="exportDates" />
--
Wendy
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org