File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes unable to iterate ArrayList which is in request scope. ArrayList contains bean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "unable to iterate ArrayList which is in request scope. ArrayList contains bean" Watch "unable to iterate ArrayList which is in request scope. ArrayList contains bean" New topic
Author

unable to iterate ArrayList which is in request scope. ArrayList contains bean

nitin jha
Greenhorn

Joined: Nov 18, 2009
Posts: 2
have ArrayList in request which contais bean object I am not able to Itrate this bean in jsp

What is the problem in this code???

ArrayList approverList = activateApproverDAO.getApproverRecord();
System.out.println("got List form PRM Database...");
Iterator itr = approverList.iterator();
while (itr.hasNext()) {
ActivateApproverBeanVO activateApproverBeanVO = (ActivateApproverBeanVO)itr.next();
System.out.println("User Id....."+ activateApproverBeanVO.getUserId());
System.out.println("Approver Type...."+activateApproverBeanVO.getApproverType());
System.out.println("Status....."+activateApproverBeanVO.getStatus());
}

request.setAttribute("listApprover", approverList);


**************************

<logic:iterate id="appId" name="listApprover" scope="request">
<bean:define id="approverRecord" name="appId"
type="com.techm.sdp.prm.vo.ActivateApproverBeanVO" />
<tr>
<logic:iterate id="approverDetail" name="approverRecord">
<td class="tdspace" align="left">
<bean:write name="approverDetail" property="userId" />
</td>
<td class="tdspace" align="left">
<bean:write name="approverDetail" property="approverType" />
</td>
<td class="tdspace" align="right">
<bean:write name="approverDetail" property="status" />
</td>
</logic:iterate>
</tr>
</logic:iterate>
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Please UseCodeTags when posting code or configuration. Unformatted code and configuration is very difficult to read. You can edit your post to include them by using the button.
Tom Rispoli
Ranch Hand

Joined: Aug 29, 2008
Posts: 349
This tag looks suspect to me:

<logic:iterate id="approverDetail" name="approverRecord">

From your code it appears that the com.techm.sdp.prm.vo.ActivateApproverBeanVO isn't a list, so you don't need to iterate over it. You might want to try taking out the inner iterate tag and setting the name attribute of your bean:write tags to approverRecord instead of approverDetail.

Hope that helps.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: unable to iterate ArrayList which is in request scope. ArrayList contains bean
 
Similar Threads
Struts 2 Iterating in ArrayList containing object Array
<logic:iterate> Update issue
JSP Radio button value retrieval
html:link in logic:iterate
javax.servlet.ServletException:javax.servlet.jsp.JspException: Cannot find bean: "riga" in any scope