You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Chetan Pandey <cp...@BLUEsingapore.com> on 2006/08/29 08:51:59 UTC
sendRedirect in Struts
I have a JSP Page. As soon as control passes to it I want to redirect to an
action:
<%
response.sendRedirect("/loggingAction.do?function=login");
%>
But the problem is I get a message: "The requested resource (/loggingAction)
is not available."
It seems JSP/Servelt method sendRedirect doesn't recognize my
struts-config.xml declarations.
Is their a Struts version for response.sendRedirect(. . .) ?
All other Struts based tags work. Example
<html:link action="/prepopulateCollectionsforProperty?function=create">
Works.
Thanks.
Chetan
Re: sendRedirect in Struts
Posted by Antonio Petrelli <br...@tariffenet.it>.
Chetan Pandey ha scritto:
> <%
>
> response.sendRedirect("/loggingAction.do?function=login");
>
> %>
>
This does not work if your webapp is not in the ROOT context (that is
the 99% of cases when developing).
Either use a relative path (i.e. remove the first '/') or use:
response.sendRedirect("/" + application.getServletContextName() + "/loggingAction.do?function=login");
HTH
Antonio
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org