• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

error with implementing a basic struts example

 
sandeep raj
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • 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
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • 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
  • 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
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah, ha--didn't catch that--good one! :)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic