This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Struts and the fly likes error with implementing a basic struts example Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "error with implementing a basic struts example" Watch "error with implementing a basic struts example" New topic
Author

error with implementing a basic struts example

sandeep raj
Greenhorn

Joined: Mar 06, 2009
Posts: 10
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

Joined: Sep 29, 2008
Posts: 12617

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

Joined: Mar 06, 2009
Posts: 10
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

Joined: Sep 29, 2008
Posts: 12617

Ah, ha--didn't catch that--good one! :)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: error with implementing a basic struts example
 
Similar Threads
update query
issue in calling the Action class
Cancel problem in struts
Getting error while running BeerStruts example
Problem running a simple webapplication in struts