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.JspExcep tion: No collection found
at org.apache.struts.taglib.l ogic.Itera teTag.doSt artTag(Ite rateTag.ja va:236)
at jsp_servlet.__pricemanager rtd._jspSe rvice(__pr icemanager rtd.java:1 98)
at weblogic.servlet.jsp.JspBa se.service (JspBase.j ava:34)
at weblogic.servlet.internal. StubSecuri tyHelper$S ervletServ iceAction. run(StubSe curityHelp er.java:22 5)
at weblogic.servlet.internal. StubSecuri tyHelper.i nvokeServl et(StubSec urityHelpe r.java:127 )
at weblogic.servlet.internal. ServletStu bImpl.exec ute(Servle tStubImpl. java:272)
at weblogic.servlet.internal. ServletStu bImpl.onAd dToMapExce ption(Serv letStubImp l.java:380 )
at weblogic.servlet.internal. ServletStu bImpl.exec ute(Servle tStubImpl. java:298)
at weblogic.servlet.internal. TailFilter .doFilter( TailFilter .java:26)
at weblogic.servlet.internal. FilterChai nImpl.doFi lter(Filte rChainImpl .java:42)
at com.nyiso.epricevalidation .security. Epricevali dationLogi nFilter.do Filter(Epr icevalidat ionLoginFi lter.java: 95)
at weblogic.servlet.internal. FilterChai nImpl.doFi lter(Filte rChainImpl .java:42)
My jsp code logic:iterate looks like:
<logic:iterate id="vo" property="someVOList" name="someForm"
type="com.org.project.vo.S omeVO">
My action form (someForm) contains a list of value objects called as someVOList. My action class is populating this using someForm.setSomeVOList(Arr ayList) 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.Str ing 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
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.JspExcep
at org.apache.struts.taglib.l
at jsp_servlet.__pricemanager
at weblogic.servlet.jsp.JspBa
at weblogic.servlet.internal.
at weblogic.servlet.internal.
at weblogic.servlet.internal.
at weblogic.servlet.internal.
at weblogic.servlet.internal.
at weblogic.servlet.internal.
at weblogic.servlet.internal.
at com.nyiso.epricevalidation
at weblogic.servlet.internal.
My jsp code logic:iterate looks like:
<logic:iterate id="vo" property="someVOList" name="someForm"
type="com.org.project.vo.S
My action form (someForm) contains a list of value objects called as someVOList. My action class is populating this using someForm.setSomeVOList(Arr
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.Str
{
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
ASKER
I tried both of those but that doesn't work..:(
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
(where abc.xyz is your pakage which contains form bean " SomeForm")
or
try removing the type="com.org.project.vo.S