• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
joydeep sarkar
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2906
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic