This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I'm using Struts 2.0.9 with Tomcat (version 5.0.30 when launched via Cargo or version 6.0.10 when launched directly).
I have index.jsp listed in my welcome-file-list in the web.xml.
The contents of index.jsp are
When I hit the context root in the web-browser I get a 404 saying that /[context-root]/home.action is not available. When I go directly to /[context-root]/home.action, via the browser's location bar the page renders correctly.
So obvisiously a) the request for the context root is getting routed to the index.jsp b) the forward is occuring c) something is happening differently for a forward to home.action versus direct navigation to home.action
Where should I be looknig to figure out what's happening?
Originally posted by Eric Nielsen: c) something is happening differently for a forward to home.action versus direct navigation to home.action
You're right about that. The "something different" is that the forward uses the RequestDispatcher to dispatch the request after it has already been received. In this case, the Struts 2 interceptors don't have a chance to look at the request and decide what to do with it. I'd suggest using a meta refresh tag pointing to the action. That way, a "redirect" will occur, which means that an instruction will be sent back to the browser telling it to redirect to a different URI. When it's done this way, the Struts interceptors do have a chance to look at the request and act on it. Example:
Or you could do it this way:
[ September 23, 2007: Message edited by: Merrill Higginson ]