| 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: 2896
|
|
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]
|
 |
 |
|
|
subject: "javax.servlet.jsp.JspException: No collection found" using logic:iterate
|
|
|