You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Mike Papper <mp...@geocities.com> on 2000/09/14 09:38:51 UTC
making "forward mappings" redirectable
Struts question #1:
We have something like the following in action.xml
<action path="/logoff"
actionClass="hhw.auth.LogoffAction">
<forward name="success" path="/index.jsp"/>
</action>
what I really want is
<action path="/logoff"
actionClass="hhw.auth.LogoffAction">
<forward name="success" path="/index.jsp"/ redirect="true">
</action>
I have looked high and low throughoutthe struts code for how to add code
to understand this and cannot find it. The closest I am getting is the
digester "magic" code that does who knows what...
anyone know if this can be done? Or how I could edit the ocde myself to
do it?
Also, if I could do such a thing then I would want the class that
"interprets" the path for a redirect to be SMARt enough to prepend the
path with the context path (but only if necessary) so that it works
correctly. (I.e., if the URL starts with / then it must be prepended with
the request.getContextPath() but if it doesnt start with a / then its a
relative url and will be interpreted relative to the current page and the
current page already has the context's path in front of it). I would be
happy to explain this in more detail.
Speaking of which, is the following from ActionServlet's
processActionInstance method a bug?
...
ActionForward forward =
actionInstance.perform(this, mapping, formInstance,
request, response);
if (forward != null) {
String path = forward.getPath();
if (forward.getRedirect()) {
response.sendRedirect(path);
shouldnt the last line be:
response.sendRedirect(response.encodeRedirectURL(path));
--
Mike Papper, E-mail: mpapp@geocities.com
Hardhat Wholesale, 180 Borica St., San Francisco, CA 94127
Tel: 510-568-7770 ext. 17, Fax: (at work) 510-568-7750