You may be able to use the existing dynamic result configuration to implement this; see these two links:
http://cwiki.apache.org/WW/result-configuration.html http://cwiki.apache.org/WW/parameters-in-configuration-results.html Dave --- On Sun, 12/14/08, Dirk Forchel wrote: 7:59 AM > Has somebody any idea regarding the problem mentioned below. > Every hint is appreciated. > > > Dirk Forchel wrote: > > > > I need your help. I wanna use the DispatcherResult > (dispatcher) not as a > > forward to a JSP (jsp/pages/test.jsp), but rather to > forwarding to another > > action request e.g. /test.action?code=1. Apparently > there is no need for > > doing that until you define something like the > following in your > > struts.xml > > > > <action name="test" > class="com.foo.TestAction"> > > <result > type="dispatcher">jsp/pages/test.jsp</result> > > </action> > > > > I have written a "Request-History" where all > HTTP-Requests are stored on a > > stack, e.g. requests like > "/test.action?code=1" or > "/welcome.action" and > > so on. If I wanna pull these requests from the stack > and make a forward to > > these action forwards (in Struts 1 I have used the > ActionForward- or > > ActionRedirect class for doing this). So how could I > forward to actions > > like this in Struts2? Where did I miss something? > > I also implemented my own Result type (HistoryResult > implements Result) > > for pulling the stored HTTP-Requests from the > history-stack and try to > > forward and/or redirect to these URLs, but it > doesn't work either. I can't > > foward to something like /test.action but I can > redirect to another > > action. Where did I miss something. Here is the peace > of code. > > > > if (redirect) > > { > > 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 { > > dispatcher.include(request, response); > > } > > } > > > > > > Here the Status after forward to this action: > > > > HTTP Status 404 - //test.action > > > > type Status report > > > > message //test.action > > > > description The requested resource (//test.action) is > not available. > > > > > > Even if I remove the first occurence of '/' > and the location is > > "test.action" rather than > "/test.action", I got the same HTTP status > > result. What's wrong with it? > > > > -- > View this message in context: > http://www.nabble.com/-S2--ServletDispatcherResult-%28dispatcher%29-and-forwarding-to-Actions-tp20950033p21000088.html > Sent from the Struts - User mailing list archive at > Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: > user-h...@struts.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org