aspose file tools*
The moose likes Struts and the fly likes Struts 2 jsp Error. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts 2 jsp Error." Watch "Struts 2 jsp Error." New topic
Author

Struts 2 jsp Error.

Vic Hood
Ranch Hand

Joined: Jan 05, 2011
Posts: 477

Hi All,
Im facing an error while trying to run my jsp .Below , is the stacktrace of my error.

Mar 18, 2011 2:42:40 PM org.apache.catalina.core.ApplicationDispatcher invoke
SEVERE: Servlet.service() for servlet jsp threw exception
tag 'select', field 'list', name 'listbean.dt_oid': The requested list key 'dtList' could not be resolved as a collection/array/map/enumeration/iterator type. Example: people or people.{name} - [unknown location]
at org.apache.struts2.components.Component.fieldError(Component.java:231)
at org.apache.struts2.components.Component.findValue(Component.java:293)
at org.apache.struts2.components.ListUIBean.evaluateExtraParams(ListUIBean.java:79)
at org.apache.struts2.components.Select.evaluateExtraParams(Select.java:99)
at org.apache.struts2.components.UIBean.evaluateParams(UIBean.java:780)
at org.apache.struts2.components.UIBean.end(UIBean.java:481)
at org.apache.struts2.views.jsp.ComponentTagSupport.doEndTag(ComponentTagSupport.java:43)
at org.apache.jsp.jsp.interface_jsp._jspx_meth_s_005fselect_005f0(interface_jsp.java:376)
at org.apache.jsp.jsp.interface_jsp._jspx_meth_s_005fform_005f0(interface_jsp.java:265)
at org.apache.jsp.jsp.interface_jsp._jspService(interface_jsp.java:165).

I think its linked to this tag
.
Please suggest how I could overcome it..
Thanks.

Learning and Learning!-- Java all the way!
Rishi Kanth
Ranch Hand

Joined: May 23, 2006
Posts: 43
"dtList" is not of type ArrayList or List in the Java class. Check the action class which is passing this parameter to the JSP file.
Vic Hood
Ranch Hand

Joined: Jan 05, 2011
Posts: 477

Hi Rishi ,
This is my action class below, and it does contain references to dtList.


So what Am I doing wrong here? Please help
sri ramvaithiyanathan
Ranch Hand

Joined: Nov 20, 2010
Posts: 109
check this Link.

Initialize your arraylist ie dtList inside your action class and add the values to arraylist.
Before moving to jsp page,check the size of the arraylist inside your action class.

Hope it will clear your doubt.
waiting for your reply


For java examples,ebooks,interview questions,visit this blog
http://periodicupdates.blogspot.com/
Vic Hood
Ranch Hand

Joined: Jan 05, 2011
Posts: 477

sri ramvaithiyanathan wrote:check this Link.
Hope it will clear your doubt.
waiting for your reply

Hi ,
I did check that link and think Ive already done whats been mentioned in the link.IVe used getters and setters of the bean list array dtList in the action class and my select tag in the jsp also fetches that particular array list an populates into the name attribute . So please advise what Im missing here > Thanks.
Raza Mohd
Ranch Hand

Joined: Jan 20, 2010
Posts: 247

Hi vic,

This error might occur if your page is having validation error and you are not navigation your Error to the most appropriate JSP.
Validation errors are encountered before calling
For example ..define result name in your struts.xml as 'ERROR' or 'INPUT' and corresponding jsp for validation error.

thanks and Regards
Raza


Good luck!!
A small leak can sink a Gigantic ship.>
Vic Hood
Ranch Hand

Joined: Jan 05, 2011
Posts: 477

Hi Raza ,
Im not using much of validation here . im just using the struts.xml for redirecting my pages.Ive attached a copy of the same .
Raza Mohd
Ranch Hand

Joined: Jan 20, 2010
Posts: 247

Hi vic,

Look at your code.might be, your method is getting exception and in the catch you assign Error to result parameter.
That might causing the page to navigate to Error which is not defined in struts.xml

Thanks and regards
Mohd Raza.
sri ramvaithiyanathan
Ranch Hand

Joined: Nov 20, 2010
Posts: 109
you have declared your arralist as

and inside action class you used as


what I am saying is initialize inside your action class like this

I am not sure whether it will work but give one try.

Regards,
Sriram.V
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts 2 jsp Error.