struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Katarina Nelson" <>
Subject RE: Iterate tag error: Cannot create iterator for this collection
Date Mon, 05 Mar 2001 09:00:30 GMT
See below for my comment:
  -----Original Message-----
  From: Craig R. McClanahan []
  Sent: den 5 mars 2001 01:27
  Subject: Re: Iterate tag error: Cannot create iterator for this collection

  Katarina Nelson wrote:
     Hi all,I know that my question is common, but I´m still struggling with
the iterate tag.Please can somebody help me?When I´m using the logic:iterate
tag I get only the following error:
    "javax.servlet.ServletException: Cannot create iterator for this
    The not working code is: <jsp:useBean id="myUser" scope="session"
    <logic:iterate id="profile" name="myUser" property="userProfiles">
        <td align="left">
          <bean:write name="profile" property="name" filter="true"/>

    The same iteration works with this code:<%
    ListIterator profileIterator = myUser.getUserProfiles().findAll();
    while (profileIterator != null && profileIterator.hasNext())

    UserProfile profile = (UserProfile);
    <tr><td width="330px"><a class="list"
href=""><%= profile.getName() %></a></td>
    <%}%>Can anybody tell me what I'mdoing wrong?

  What kind of object does the getUserProfiles() method return?  In order
for Struts to work, this must be an array, a Collection, an Iterator, or a
Map.  The fact that your code has to call findAll() to get an iterator
implies that your method does not return one of these.
  [Katarina Nelson] It's return an object "UserProfiles":

  public UserProfiles getUserProfiles() {
        return userProfiles;

  So, is it impossible to by using the findAll() (which returns
ListItrerator) iterate the "profile"?
  Craig McClanahan

View raw message