Link to home
Start Free TrialLog in
Avatar of curious81
curious81

asked on

Cannot access collection from action form in jsp

Hi,
     I am working on a project using struts. I have a collection (arraylist in particular) defined in my action form and I am trying to access that collection in my jsp using logic:iterate. When I try to hit that jsp, it gives me the following error:

javax.servlet.jsp.JspException: No collection found
      at org.apache.struts.taglib.logic.IterateTag.doStartTag(IterateTag.java:236)
      at jsp_servlet.__pricemanagerrtd._jspService(__pricemanagerrtd.java:198)
      at weblogic.servlet.jsp.JspBase.service(JspBase.java:34)
      at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:225)
      at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:127)
      at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:272)
      at weblogic.servlet.internal.ServletStubImpl.onAddToMapException(ServletStubImpl.java:380)
      at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:298)
      at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
      at com.nyiso.epricevalidation.security.EpricevalidationLoginFilter.doFilter(EpricevalidationLoginFilter.java:95)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)


My jsp code logic:iterate looks like:
<logic:iterate id="vo" property="someVOList" name="someForm"
                type="com.org.project.vo.SomeVO">

My action form (someForm) contains a list of value objects called as someVOList. My action class is populating this using someForm.setSomeVOList(ArrayList) and I am able to see the list populated in the Action class. My action form looks like

public class SomeForm extends ActionForm
{
      /*
       * This is iterated to display the RTD Intervals on the RTD screen
       */
      String teststring = "My test";
      ArrayList someVOList;
      public ArrayList getSomeVOList() {
            return someVOList;
      }
      public void setSomeVOList(ArrayList voList) {
            someVOList = voList;
      }
      public String getTeststring() {
            return teststring;
      }
      public void setTeststring(String teststring) {
            this.teststring = teststring;
      }
}

The individual value object looks like:

public class SomeVO implements java.io.Serializable
{
    private java.lang.String startDate = null;
    public java.lang.String getStartDate()
    {
        return this.startDate;
    }

    public void setStartDate(java.lang.String startDate)
    {
        this.startDate = startDate;
    }
}

If I try to access the testString from my someForm, I can do it. But I am getting error while accessing the collection object. Am I writing the logic:iterate tag properly? I am missing something silly here. Can anyone please help?

Thanks
Avatar of jaggernat
jaggernat

change  type="com.org.project.vo.SomeVO"  to    type="abc.xyz.SomeForm "
(where abc.xyz is your pakage which contains form bean " SomeForm")

or

 try removing the type="com.org.project.vo.SomeVO" attribute from the tag
Avatar of curious81

ASKER

I tried both of those but that doesn't work..:(
ASKER CERTIFIED SOLUTION
Avatar of jaggernat
jaggernat

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial