You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Mathieu Grimault <gr...@presidence.univ-nantes.fr> on 2003/11/05 14:16:28 UTC

Newbie question....redirect

Hi all !

Sorry, about a such stupid question but I try to have my application redirects to an external web site with some parameters. 

Here is an exemple : http://payOnline/$cashAmout/$name

For the moment i'm just try to redirect to an external website like yahoo but the search path is always "/context/http://www.yahoo.fr". What's wrong ?

Here is a snipet from struts-config.xml :

<action path = "/Bonjour"

type = "BonjourAction"

name = "BonjourForm"

scope = "request"

input = "/index.jsp"

validate = "true"

>

    <forward name="oui" path="http://www.yahoo.fr" contextRelative="false" redirect="true"/>

</action>



Environment : struts 1.1, tomcat 4.1.27, jdk 1.4.2_02

Re: Newbie question....redirect

Posted by Nicolas De Loof <ni...@cgey.com>.
contextRelative is used to define a forward that is relative to the application context and not to the module context
(default).

You cannot redirect to an URL outside your app using struts-config <forward>. Use a requestDispatcher in your action and
call sendRedirect(), or create a new JSP with a <html:redirect href="http://www.yahoo.com"> tag

Nico.


----- Original Message ----- 
From: "Mathieu Grimault" <gr...@presidence.univ-nantes.fr>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Wednesday, November 05, 2003 2:16 PM
Subject: Newbie question....redirect


Hi all !

Sorry, about a such stupid question but I try to have my application redirects to an external web site with some
parameters.

Here is an exemple : http://payOnline/$cashAmout/$name

For the moment i'm just try to redirect to an external website like yahoo but the search path is always
"/context/http://www.yahoo.fr". What's wrong ?

Here is a snipet from struts-config.xml :

<action path = "/Bonjour"

type = "BonjourAction"

name = "BonjourForm"

scope = "request"

input = "/index.jsp"

validate = "true"

>

    <forward name="oui" path="http://www.yahoo.fr" contextRelative="false" redirect="true"/>

</action>



Environment : struts 1.1, tomcat 4.1.27, jdk 1.4.2_02


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org