Win a copy of Zero to AI - A non-technical, hype-free guide to prospering in the AI era this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

Struts 2 jsp Error.

 
Ranch Hand
Posts: 477
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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
Posts: 477
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rishi ,
This is my action class below, and it does contain references to dtList.


So what Am I doing wrong here? Please help
 
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Vic Hood
Ranch Hand
Posts: 477
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
 
Ranch Hand
Posts: 247
MyEclipse IDE MySQL Database Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Vic Hood
Ranch Hand
Posts: 477
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 247
MyEclipse IDE MySQL Database Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Weeds: because mother nature refuses to be your personal bitch. But this tiny ad is willing:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic