You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Sunder <sr...@epicedge.com> on 2002/03/26 03:22:43 UTC
html:options Iterator Creation error -
Hi,
I am trying to implement the html:options tag in one of our
applications,
I have a form bean with the following attributes,
private Collection securityOptions = null;
private String security = "Default";
In my action class, I populate the collection with
PersonalForm perform = (PersonalForm) form;
Collection list = (Collection) new ArrayList();
for(int i = 0; i<10; i++)
{
list.add(new LabelValueBean("Default","Value"));
}
perform.setSecurityOptions(list);
and finally in my jsp, I try to display the collection using
html:options tag as follows
<html:select property="security" multiple="false">
<bean:define id="myCollection" name="personalForm"
property="securityOptions"/>
<html:options collection="myCollection" property="value"
labelProperty="label"/>
</html:select>
I get the following error when I try to view the page
javax.servlet.ServletException: Cannot create iterator for
at
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContex
tImpl.java:463)
at
org.apache.jsp.personal$jsp._jspService(personal$jsp.java:1031)
at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServle
t.java:202)
at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:382)
at
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:474)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatc
her.java:683)
----- Root Cause -----
javax.servlet.jsp.JspException: Cannot create iterator for
at
org.apache.struts.taglib.html.OptionsTag.getIterator(OptionsTag.java:420
)
at
org.apache.struts.taglib.html.OptionsTag.doEndTag(OptionsTag.java:222)
at
org.apache.jsp.personal$jsp._jspService(personal$jsp.java:785)
at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
Any comments,suggestions? Appreciate your help.
Thanks,
Sunder
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: html:options Iterator Creation error -
Posted by Ted Husted <hu...@apache.org>.
If PersonalForm has a
Collection getSecurityOptions();
method then it does look OK.
This shouldn't matter, but you could try a type property with
bean:define
-Ted.
Sunder wrote:
>
> Hi,
> I am trying to implement the html:options tag in one of our
> applications,
>
> I have a form bean with the following attributes,
>
> private Collection securityOptions = null;
> private String security = "Default";
>
> In my action class, I populate the collection with
>
> PersonalForm perform = (PersonalForm) form;
> Collection list = (Collection) new ArrayList();
> for(int i = 0; i<10; i++)
> {
> list.add(new LabelValueBean("Default","Value"));
> }
> perform.setSecurityOptions(list);
>
> and finally in my jsp, I try to display the collection using
> html:options tag as follows
>
> <html:select property="security" multiple="false">
> <bean:define id="myCollection" name="personalForm"
> property="securityOptions"/>
> <html:options collection="myCollection" property="value"
> labelProperty="label"/>
> </html:select>
>
> I get the following error when I try to view the page
>
> javax.servlet.ServletException: Cannot create iterator for
> at
> org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContex
> tImpl.java:463)
> at
> org.apache.jsp.personal$jsp._jspService(personal$jsp.java:1031)
> at
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> at
> org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServle
> t.java:202)
> at
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:382)
> at
> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:474)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> at
> org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatc
> her.java:683)
> ----- Root Cause -----
> javax.servlet.jsp.JspException: Cannot create iterator for
> at
> org.apache.struts.taglib.html.OptionsTag.getIterator(OptionsTag.java:420
> )
> at
> org.apache.struts.taglib.html.OptionsTag.doEndTag(OptionsTag.java:222)
> at
> org.apache.jsp.personal$jsp._jspService(personal$jsp.java:785)
> at
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>
> Any comments,suggestions? Appreciate your help.
>
> Thanks,
> Sunder
>
> --
> To unsubscribe, e-mail: <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>