I`m new to Struts2 and trying to get a simple example up and running. Can't seem to figure out where I`m going wrong.
I`m just trying to print out a hello message with the value input in the index.jsp. Once the value is submitted in the Index.jsp, I keep getting
a HTTP 404 error saying that 'The requested resource is not available'. Appreciate answers to point me in the right direction.
to get struts running you have to use struts tags, you have used HTML tags
here is what it ll look like after you ll use struts tag
hope this helps
Joined: Feb 26, 2013
I had already tried using the struts tags as you mentioned earlier, but resorted to using the html tag as I was getting the following exception.
When using html tags, I was able to view the index.jsp page atleast, the problem occurred only when submitting the page.
1) Are you trying to access the JSP page directly with the struts tags ? Sometimes this error arises due to directly accessing the JSP and not letting the Dispatcher to initialize the request processing cycle and create needed value stack. In this case , you will have to write an action class that you will initialy hit which will then render the JSP page for you.
2) My second guess is the filterDispatcher. This may be the cause of the issue and I am just sharing my experience because I spent countless hours to determine the solution to this problem when I started learning struts. In the web.xml you have defined the filterDispatcher as org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter , try changing this to the old dispatcher org.apache.struts2.dispatcher.FilterDispatcher. Again , this step is just a wild guess I am taking , it may or may not solve your problem.
3) what URL do you type to invoke your action ?
Muhammad Saif Asif Mirza
OCJA(5/6) OCJP(6) OCJWCD(6)
subject: Struts2: Simple example-Action not getting invoked; status 404