• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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]
 
I guess I've been abducted by space aliens. So unprofessional. They tried to probe me with this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic