I am having a lot of trouble trying out this first struts example. I am very new to struts. I am running this example with struts 1.2.2 and tomcat 5.0.28 and i am getting the Exception in the heading. Please tell me where i have gone wrong. Been doing this for hours now ! I looked at other posts where people complained that this error was being thrown but it didnt help me much.
The main problem is that your web.xml file is incorrect. IndexAction is not a servlet and should not be declared in web.xml. Your web.xml file should look like this:
A Struts application typically has only one servlet, and that is the Struts ActionServlet. The subclasses of the Action class that you write are declared in the struts-config.xml file, but not in web.xml.
Thanks everyone ! I got it to work. Here are the changes i made.
* Changed the web.xml like i was asked to.
* Did an override of the execute method since control was not transfered to my action if i used the perform method.
* Changed the dtd url to the correct version. If the correct version is not given the web container will not be able to understand your tags properly and will throw an error saying for example "action" tag must be defined before use : "forward" tag must be defined before use.