struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Todd Pierce <>
Subject RE: How to user logic:iterate
Date Mon, 09 Sep 2002 23:41:24 GMT
Your arraylist isn't in the page context. Try this:

    ArrayList users = (ArrayList) request.getAttribute("users");
    pageContext.setAttribute("userList", users);

    <logic:iterate name="userList" id="aUser" scope="request">
      <td><bean:write name="aUser" property="user.userID"/></td>

or use the collection attribute instead of the name attribute in the iterate
tag, ike this:

    ArrayList users = (ArrayList) request.getAttribute("users");

    <logic:iterate collection="<%= users %>" id="aUser" scope="request">
      <td><bean:write name="aUser" property="user.userID"/></td>

-----Original Message-----
From: Michael Lee []
Sent: Tuesday, 10 September 2002 6:56 AM
To: Struts Users Mailing List
Subject: How to user logic:iterate

Im having a helluva time getting logic:iterate to work..
I have a Users object that contains an array list of
User objects.
you call Users.getUsers() and it returns an arrayList
I stick that in the request object in the perform() method using
request.setAttribute("users", users.getUsers());
In the JSP the code I have is;

 <% ArrayList users = (ArrayList) request.getAttribute("users");
       if(users != null)
    <logic:iterate name="users" id="aUser" scope="request">
      <td><bean:write name="aUser" property="user.userID"/></td>
      <td><bean:write name="aUser" property="user.userType"/></td>
      <td><bean:write name="aUser" property="user.fName"/></td>
      <td><bean:write name="aUser" property="user.mName"/></td>
      <td><bean:write name="aUser" property="user.lName"/></td>
      <td><bean:write name="aUser" property="user.accoundDisabled"/></td>
      <td><bean:write name="aUser" property=""/></td>

The error I'm getting is;

<Sep 9, 2002 4:52:00 PM EDT> <Error> <HTTP>
ptsplus,/receiptsplus)] Root cause of ServletException
javax.servlet.jsp.JspException: Cannot find bean aUser in scope null
        at org.apache.struts.util.RequestUtils.lookup(
        at weblogic.servlet.jsp.JspBase.service(

what am I doing wrong?

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message