Sébastien Domergue wrote:
>
> we had nearly the same problem in a project and we had to build our own
> stack (which contained both action and jsp names) and when we wanted to
> go back we used the stack.
In the meantime I wrote my own history stack with the request URIs pushed to
the stack.
I also wrote my own Result-Type called HistoryResult which works fine for
redirects only.
I can't do forwards to actions e.g. "/welcome.action" but only to JSPs e.g.
"/welcome.jsp".
Here are parts of the code:
if (redirect)
{
System.out.println(">>>> REDIRECT to location "+location);
sendRedirect(response, location);
}
else
{
RequestDispatcher dispatcher =
request.getRequestDispatcher(location);
// if the view doesn't exist, let's do a 404
if (dispatcher == null) {
response.sendError(404, "result '" + location + "' not
found");
return;
}
// If we're included, then include the view
// Otherwise do forward
// This allow the page to, for example, set content type
if (!response.isCommitted() &&
(request.getAttribute("javax.servlet.include.servlet_path") == null)) {
request.setAttribute("struts.view_uri", location);
request.setAttribute("struts.request_uri",
request.getRequestURI());
dispatcher.forward(request, response);
} else {
System.out.println(">>>> INCLUDE to ");
dispatcher.include(request, response);
}
}
So what could be wrong with forward to Actions? Where do I miss the piece of
cake?
--
View this message in context:
http://www.nabble.com/S2%3A-Forward-or-Redirect-to-same-page-tp20930597p20936196.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]