Results 1 to 4 of 4
  1. #1
    orchid's Avatar
    orchid is offline Member
    Join Date
    Apr 2007
    Location
    Midwest
    Posts
    60
    Rep Power
    0

    Default struts No Collection Found

    I am getting this error:"javax.servlet.ServletException: No collection found
    org.apache.jasper.runtime.PageContextImpl.doHandle PageException(PageContextImpl.java:825)"
    I have been googling for the answer and nothing helps. I do what they say but there seem to be a lot of unanswered questions about this.
    Here are the details. The list has 4 elements in it.

    //jsp looks like this

    <logic:iterate name="protocolListForm" property="protocols" id="protocol">
    list will be here
    </logic:iterate>

    //Action looks like this
    Java Code:
    System.out.println("Size of list is " + results.size());
    ProtocolListForm pForm = new ProtocolListForm(results);
    //Form looks like this
    Java Code:
    private List<CollectionProtocol> protocols = null;
    public ProtocolListForm(List <CollectionProtocol>results)
    {
      this.protocols=results;
    }
    
    public List getProtocols()
    {
    	return protocols;
    }
    public void setProtocols(List <CollectionProtocol>protocols)
    {
    	this.protocols = protocols;
    }

  2. #2
    orchid's Avatar
    orchid is offline Member
    Join Date
    Apr 2007
    Location
    Midwest
    Posts
    60
    Rep Power
    0

    Default

    I ended up just putting it in the request like so...
    request.setAttribute("protocols",results);
    and it works fine, but why will it not work if I put the collection in the ActionForm ? I am stumped.

  3. #3
    pegitha is offline Member
    Join Date
    Apr 2007
    Location
    Indiana
    Posts
    83
    Rep Power
    0

    Default

    Put your form into the request, otherwise it just uses the blank form. Its wierd I know....
    request.setAttribute("protocolListForm", pForm);
    Yet one more reason I would love to move away from struts and jsp.
    p

  4. #4
    javanar is offline Member
    Join Date
    Feb 2010
    Posts
    4
    Rep Power
    0

    Default programmer should know where to look

    Quote Originally Posted by pegitha View Post
    Put your form into the request, otherwise it just uses the blank form. Its wierd I know....
    request.setAttribute("protocolListForm", pForm);
    Yet one more reason I would love to move away from struts and jsp.
    p

    I have encountered the same problem. The reason was I have included the same form bean as a bean in jsp with the same name.

    As I guess the reason is the bean you defined in jsp, which have no collections assigned, is used instead of the one that is filled in Action class.

    Remove the bean declaration or rename it, so it should work.


    Java is the best for enterprise development!

Similar Threads

  1. Class not found Exception
    By surendra in forum Java Servlet
    Replies: 8
    Last Post: 06-09-2011, 12:52 PM
  2. could not be found in the registry
    By alam99 in forum Eclipse
    Replies: 0
    Last Post: 01-08-2008, 08:21 AM
  3. 404 Not Found
    By mary in forum Java Servlet
    Replies: 5
    Last Post: 11-07-2007, 10:15 AM
  4. ConnectException not found
    By tamayo in forum New To Java
    Replies: 1
    Last Post: 07-23-2007, 08:23 AM
  5. Hibernate table not found
    By orchid in forum JDBC
    Replies: 2
    Last Post: 05-06-2007, 07:44 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •