• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Jeanne Boyarsky
  • Tim Cooke
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
Bartenders:

Struts 2 jsp Error.

 
Ranch Hand
Posts: 477
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Everybody! Do the Funky Monkey! Like this tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic