This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes No collection Found Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "No collection Found" Watch "No collection Found" New topic
Author

No collection Found

naresh kumar k
Ranch Hand

Joined: May 25, 2011
Posts: 30
hi Ranchers,

When I tried to display data in table using Iterate(struts tag) i got following exception "NO Collection Found".
I used struts and hibernate

and stack trace is.....
ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/CSWeb].[jsp]] Servlet.service() for servlet jsp threw exception: javax.servlet.jsp.JspException: No collection found
at org.apache.struts.taglib.logic.IterateTag.doStartTag(IterateTag.java:242) [:1.3.8]
at org.apache.jsp.gui.products_jsp._jspService(products_jsp.java:192)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) [:6.0.0.Final]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [:1.0.0.Final]
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369) [:6.0.0.Final]
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326) [:6.0.0.Final]
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:253) [:6.0.0.Final]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [:1.0.0.Final]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:324) [:6.0.0.Final]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242) [:6.0.0.Final]
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:734) [:6.0.0.Final]
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:639) [:6.0.0.Final]
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:576) [:6.0.0.Final]
at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:968) [:6.0.0.Final]
at org.apache.jasper.runtime.PageContextImpl.doInclude(PageContextImpl.java:650) [:6.0.0.Final]
at org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:644) [:6.0.0.Final]
at sun.reflect.GeneratedMethodAccessor305.invoke(Unknown Source) [:1.6.0]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) [:1.6.0]
at java.lang.reflect.Method.invoke(Unknown Source) [:1.6.0]
at org.apache.struts.tiles.TilesUtilImpl.doInclude(TilesUtilImpl.java:129) [:1.3.8]
at org.apache.struts.tiles.TilesUtil.doInclude(TilesUtil.java:152) [:1.3.8]
at org.apache.struts.tiles.taglib.InsertTag.doInclude(InsertTag.java:764) [:1.3.8]
at org.apache.struts.tiles.taglib.InsertTag$InsertHandler.doEndTag(InsertTag.java:896) [:1.3.8]
at org.apache.struts.tiles.taglib.InsertTag.doEndTag(InsertTag.java:465) [:1.3.8]
at org.apache.jsp.gui.coldstorage_002dlayout_jsp._jspx_meth_tiles_005finsert_005f2(coldstorage_002dlayout_jsp.java:221)
at org.apache.jsp.gui.coldstorage_002dlayout_jsp._jspService(coldstorage_002dlayout_jsp.java:119)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) [:6.0.0.Final]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [:1.0.0.Final]
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369) [:6.0.0.Final]
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326) [:6.0.0.Final]
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:253) [:6.0.0.Final]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [:1.0.0.Final]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:324) [:6.0.0.Final]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242) [:6.0.0.Final]
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:734) [:6.0.0.Final]
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:541) [:6.0.0.Final]
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:479) [:6.0.0.Final]
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:407) [:6.0.0.Final]
at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1078) [:1.3.8]
at org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:295) [:1.3.8]
at org.apache.struts.tiles.TilesRequestProcessor.processTilesDefinition(TilesRequestProcessor.java:271) [:1.3.8]
at org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:332) [:1.3.8]
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:232) [:1.3.8]
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913) [:1.3.8]
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449) [:1.3.8]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:734) [:1.0.0.Final]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [:1.0.0.Final]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:324) [:6.0.0.Final]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242) [:6.0.0.Final]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [:6.0.0.Final]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) [:6.0.0.Final]
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:181) [:6.0.0.Final]
at org.jboss.modcluster.catalina.CatalinaContext$RequestListenerValve.event(CatalinaContext.java:285) [:1.1.0.Final]
at org.jboss.modcluster.catalina.CatalinaContext$RequestListenerValve.invoke(CatalinaContext.java:261) [:1.1.0.Final]
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:88) [:6.0.0.Final]
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:100) [:6.0.0.Final]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) [:6.0.0.Final]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [:6.0.0.Final]
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158) [:6.0.0.Final]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [:6.0.0.Final]
at org.jboss.web.tomcat.service.request.ActiveRequestResponseCacheValve.invoke(ActiveRequestResponseCacheValve.java:53) [:6.0.0.Final]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362) [:6.0.0.Final]
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [:6.0.0.Final]
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:654) [:6.0.0.Final]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:951) [:6.0.0.Final]
at java.lang.Thread.run(Unknown Source) [:1.6.0]


15:08:17,484 ERROR [org.apache.struts.tiles.taglib.InsertTag] ServletException in '/gui/products.jsp': javax.servlet.jsp.JspException: No collection found: org.apache.jasper.JasperException: An exception occurred processing JSP page /gui/products.jsp at line 57

54: <td>Packet Type</td>
55: </tr>
56: <logic:present name="CSProductsForm">
57: <logic:iterate id="productItr" name="CSProductsForm" property="productList" scope="request">
58: <tr>
59: <bean:write name="productItr" property="productName" />
60: <bean:write name="productItr" property="productType" />
........................

Caused by: javax.servlet.ServletException: javax.servlet.jsp.JspException: No collection found
at org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:862) [:6.0.0.Final]
at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791) [:6.0.0.Final]
at org.apache.jsp.gui.products_jsp._jspService(products_jsp.java:326)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) [:6.0.0.Final]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [:1.0.0.Final]
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369) [:6.0.0.Final]
... 57 more
Caused by: javax.servlet.jsp.JspException: No collection found
at org.apache.struts.taglib.logic.IterateTag.doStartTag(IterateTag.java:242) [:1.3.8]
at org.apache.jsp.gui.products_jsp._jspService(products_jsp.java:192)
... 60 more
.......................and more



here is my Jsp page code for iterator




Action class:



My form class:


and List getter and setter class:<ProductDisplay>


Struts-config.xml:





And i can gaurentee that DAO code is correct and I am able to retrieve data from DB and even action class data is there in list.
I searched many forms but cannot what the fault in my code.
please help me on this.
thanks in advance
regards
Naresh Kumar K
Chandan Sarma
Greenhorn

Joined: Oct 04, 2011
Posts: 14
I think you might have redirect your page so the collection in not available in request make the redirect false and try
naresh kumar k
Ranch Hand

Joined: May 25, 2011
Posts: 30
hi Chandan Sarma,
thank you very for your reply. I did what you told i.e.. redirect="false"
But no use again i am facing same exception "no collection found"

will be waiting for your reply
with regards
naresh kumar k
Chandan Sarma
Greenhorn

Joined: Oct 04, 2011
Posts: 14
i thing i got the solution .do one thing your iterator change the property ="productList " to name="productList. I think it should work.
naresh kumar k
Ranch Hand

Joined: May 25, 2011
Posts: 30
hi Chandan Sarma,
thanks for the quick reply.I tried what you told but i am facing another error:::: Cannot find bean: "productList" in scope: "request".

One thing if i remove property and place name="productList" how could we have getter and setters without form classs

with regards
naresh kumar k
Chandan Sarma
Greenhorn

Joined: Oct 04, 2011
Posts: 14
hi.
just do one things put the attribute in session and declare the list as List<yourclassname> list=new ArrayList<yourclassname>().and used getter and setter for that class. try it. you might have removed redirect=false.if you are using request you shoud not redirect the page.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: No collection Found
 
Similar Threads
Servlet.service() for servlet jsp threw exception: java.lang.NullPointerException
Unhandled exception: javax.servlet.ServletException: BeanUtils.populate
exception handling in jsp
Struts Validation problem
exception handling