You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Wes Rood <we...@myfastmail.com> on 2003/07/11 18:15:21 UTC
need help with nested:iterate tag -- NullPointerException
Hi
I was trying to convert a logic:iterate into a nested:iterate and I'm
getting a NullPointerException.
First off, the Action is adding a List to the request like this:
request.setAttribute("courseProviderList", theList);
and the JSP is successfully iterating through the objects using
logic:iterate:
<logic:iterate id="element" name="courseProviderList"
type="com.CourseProvider">
<bean:write name="element" property="oid" />
... etc
</logic:iterate>
But when I tried nested:iterate:
<nested:iterate name="courseProviderList" type="com.CourseProvider">
<nested:write property="oid"/>
</nested:iterate>
I get the following exception:
java.lang.NullPointerException
at java.util.Hashtable.put(Hashtable.java:380)
at
org.apache.jasper.runtime.PageContextImpl.setAttribute(PageContextImp
l.java:234)
at
org.apache.struts.taglib.logic.IterateTag.doStartTag(IterateTag.java:
367)
at
org.apache.struts.taglib.nested.logic.NestedIterateTag.doStartTag(Nes
tedIterateTag.java:116)
at
org.apache.jsp.listCourseProviders_jsp._jspService(listCourseProvider
s_jsp.java:88)
... etc
-----------------------
I can get it to work if I define a FormBean, and use it as follows:
((ListCourseProvidersForm)form).setCourseProviders(theList);
with:
<nested:iterate name="ListCourseProvidersForm" property="courseProviders">
<nested:write property="oid" />
.. etc
</nested:iterate>
But shouldn't it also work when the collection is directly an attribute
of the request object?
Thanks,
Wes
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org