File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes problem in logic:Iterate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "problem in logic:Iterate" Watch "problem in logic:Iterate" New topic

problem in logic:Iterate

Mike Jeya
Ranch Hand

Joined: Apr 15, 2004
Posts: 54
I have a arraylist of Objects(JavaBen with get,set methods).I placed in ActionClass's request

I am trying to acesss the values of javaBEan in the forwarded JSP pages

Here the BeanList is a ArrayList Object..
phaseName is the variable in JavaBean..

<logic:iterate name="BeanList" scope="request" id="obj">
<td><bean:write name="obj" property="phaseName"/></td>

but the error says
javax.servlet.ServletException: Cannot find bean BeanList in scope request

Can anyone tell me what mistake am I doing
[ September 13, 2004: Message edited by: Mike Jeya ]
sreenath reddy
Ranch Hand

Joined: Sep 21, 2003
Posts: 415

Check out whether that arraylist is properly set r not.try to check that before using that tag .its null thats why its showing that exception
Sheldon Fernandes
Ranch Hand

Joined: Aug 18, 2004
Posts: 157
What is the key you have used when setting the list of beans in request? You might have done something like this:
request.setAttribute("aKey", aBeanList);

Use the same key (for example "aKey") in the name attribute of the <logic:iterate> tag.
In other words, verify if "BeanList" is the key.
Mike Jeya
Ranch Hand

Joined: Apr 15, 2004
Posts: 54
Thank u guys..

I solved that problem..

I haven't mentioned the scope as request in action path (struts-config.xml)
I agree. Here's the link:
subject: problem in logic:Iterate
It's not a secret anymore!