struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Wes Rood <wes9...@myfastmail.com>
Subject need help with nested:iterate tag -- NullPointerException
Date Fri, 11 Jul 2003 16:15:21 GMT
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


Mime
View raw message