• 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

Struts2: Simple example-Action not getting invoked; status 404

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.


Following are the files used:

index.jsp ----->WebContent
HelloWorld.jsp ----->WebContent

struts.xml ----->WebContent/WEB-INF/classes
web.xml ----->WebContent/WEB-INF
HelloWorldAction.java

Index.jsp




struts.xml




web.xml

 
Ranch Hand
Posts: 47
MyEclipse IDE Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
woah woah!!
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

Ankit
 
Baz Matt
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
Any ideas?

 
Ranch Hand
Posts: 440
Hibernate Eclipse IDE Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Baz Matt ,

First I want you to check 2 things,

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 ?
reply
    Bookmark Topic Watch Topic
  • New Topic