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 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark ""javax.servlet.jsp.JspException: No collection found"  using logic:iterate" Watch ""javax.servlet.jsp.JspException: No collection found"  using logic:iterate" New topic
Author

"javax.servlet.jsp.JspException: No collection found" using logic:iterate

joydeep sarkar
Greenhorn

Joined: Nov 13, 2008
Posts: 23
Hello All,

I am getting javax.servlet.jsp.JspException: No collection found while using logic:iterate.
Following is the code snippet. Can anyone please tell me what is required to be done?

ActionForm:
public void setTopicList(Collection topicList) {
this.topicList = topicList;
}

public Collection getTopicList() {
return topicList;
}


struts-config.xml
<form-beans>
<form-bean name="forumForm" type="lbny.ForumForm"/>
</form-beans>
.
.
.
<action path="/forum" type="lbny.ForumAction" name="forumForm" scope="request">
<forward name="success" path="/forum.jsp"/>
</action>

jsp
<logic:iterate id="lbnyForumTopic" name="forumForm" property="topicList" type="dto.ForumTopicDTO">
<tr>
<td><% out.print(lbnyForumTopic.getTopicName()); %> </td>
</tr>
</logic:iterate>

Regards,
Joydeep
joydeep sarkar
Greenhorn

Joined: Nov 13, 2008
Posts: 23
Hello All,

I have found the solution to the problem.
If the resultset returned does not contain any data, the logic:iterator tag does not get any data to to traverse through. That is why it throws an exception.

Please let me know if the analysis is incorrect.
Is there any way to overcome this scenario?

Regards,
Joydeep
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

joydeep sarkar wrote:
I have found the solution to the problem.
If the resultset returned does not contain any data, the logic:iterator tag does not get any data to to traverse through. That is why it throws an exception.

If this is what happening then, check on the JSP page whether "forumForm" exits or not ,

and make sure you set the "forumForm" in request scope if and only if its contain some records, like

[Please check the methods and tag attributes validness]


[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: "javax.servlet.jsp.JspException: No collection found" using logic:iterate