• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

error with implementing a basic struts example

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to implement a simple struts example but am getting a few errors when trying to call the action servlet .

My input html page has the following


The form bean for this html is



while my action object class is as follows



The web.xml file has the following mapping



and the struts-config.xml file has the following

display.jsp is just a jsp page which calls the attributes i saved in the action object and displays them

I am able to launch tomcat but when i click the submit button of the html page i.e request the action servlet i get the following exception



can anyone help me figure out what i am doing wrong
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you deploying to the root context? Can you access the action directly? (Calling an action "controllerServlet" is *really* misleading, since it's neither the controller, nor a servlet, btw.)

Also, there's no reason to validate against the request parameter directly in validate(); that somewhat defeats the purpose of having the ActionForm. I'd also recommend using the Struts HTML tags to implement the form, but that's a separate issue.
 
sandeep raj
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks david.. this was actually my first trial of implementing a struts example so i was more focused on getting it to work .. thanks for the input though.. i figured out the mistake btw .. i made the blunder of spelling the controller servlet action in the action mapping of struts-config.xml with a capital 'C'
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ah, ha--didn't catch that--good one! :)
 
reply
    Bookmark Topic Watch Topic
  • New Topic