You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Michael Oliver <ol...@sourceonenet.com> on 2005/01/27 20:53:42 UTC
How to Forward out of struts to a URL from an Action
I would like to forward the user out of struts to a URL after an action
executes without additional user input, what is the best way in Struts?
I can use a page that has a redirect javascript in it, but is there a
facility in Struts to do this?
Michael Oliver
CTO
Alarius Systems LLC
3325 N. Nellis Blvd, #1
Las Vegas, NV 89115
Phone:(702)643-7425
Fax:(520)844-1036
*Note new email changed from oliverm@matrix-media.com
Re: How to Forward out of struts to a URL from an Action
Posted by Wendy Smoak <ja...@wendysmoak.com>.
From: "Michael Oliver" <ol...@sourceonenet.com>
> Thanks except in your example your forward isn't "outside" it is to an
> action in that struts application, I want to go to a URL outside the
> application, elsewhere on the same server but not to an action or jsp
> page.
Do the redirect yourself, and return null from execute().
--
Wendy Smoak
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
RE: How to Forward out of struts to a URL from an Action
Posted by Michael Oliver <ol...@sourceonenet.com>.
Thanks except in your example your forward isn't "outside" it is to an
action in that struts application, I want to go to a URL outside the
application, elsewhere on the same server but not to an action or jsp
page.
I tried
Path="/myhtml/somehtml.html" and it threw a Configuration Frozen
exception.
Michael Oliver
CTO
Alarius Systems LLC
3325 N. Nellis Blvd, #1
Las Vegas, NV 89115
Phone:(702)643-7425
Fax:(520)844-1036
*Note new email changed from oliverm@matrix-media.com
-----Original Message-----
From: listed@gmx.net [mailto:listed@gmx.net]
Sent: Thursday, January 27, 2005 12:11 PM
To: Struts Users Mailing List
Subject: Re: How to Forward out of struts to a URL from an Action
Hi Michael,
have a look in your struts-config.xml.
<forward name = "Success"
path = "/ViewSettings.do"
redirect = "true"/>
Greets Mark
Michael Oliver wrote:
>I would like to forward the user out of struts to a URL after an action
>executes without additional user input, what is the best way in Struts?
>I can use a page that has a redirect javascript in it, but is there a
>facility in Struts to do this?
>
>
>
>Michael Oliver
>
>CTO
>
>Alarius Systems LLC
>
>3325 N. Nellis Blvd, #1
>
>Las Vegas, NV 89115
>
>Phone:(702)643-7425
>
>Fax:(520)844-1036
>
>*Note new email changed from oliverm@matrix-media.com
>
>
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: How to Forward out of struts to a URL from an Action
Posted by li...@gmx.net.
Hi Michael,
have a look in your struts-config.xml.
<forward name = "Success"
path = "/ViewSettings.do"
redirect = "true"/>
Greets Mark
Michael Oliver wrote:
>I would like to forward the user out of struts to a URL after an action
>executes without additional user input, what is the best way in Struts?
>I can use a page that has a redirect javascript in it, but is there a
>facility in Struts to do this?
>
>
>
>Michael Oliver
>
>CTO
>
>Alarius Systems LLC
>
>3325 N. Nellis Blvd, #1
>
>Las Vegas, NV 89115
>
>Phone:(702)643-7425
>
>Fax:(520)844-1036
>
>*Note new email changed from oliverm@matrix-media.com
>
>
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: How to Forward out of struts to a URL from an Action
Posted by Keshav Shetty <Ke...@eurodyn.com>.
In struts you can redirect(not forward) to other page or site.
In your action instead of mapping.findforward use following code
ActionForward toAction= new ActionForward ();
ActionForward fromAction = mapping.findForward("targetURL");
toAction.setPath(fromAction.getPath());
toAction.setRedirect(true);
return toAction;
Please note targetURL is defined in your struts config file.
The above code acts as redirect and not as forward.
Also you can add queryStrings to URL (if required).
Please write me if you need any addtional info.
Michael Oliver wrote:
>I would like to forward the user out of struts to a URL after an action
>executes without additional user input, what is the best way in Struts?
>I can use a page that has a redirect javascript in it, but is there a
>facility in Struts to do this?
>
>
>
>Michael Oliver
>
>CTO
>
>Alarius Systems LLC
>
>3325 N. Nellis Blvd, #1
>
>Las Vegas, NV 89115
>
>Phone:(702)643-7425
>
>Fax:(520)844-1036
>
>*Note new email changed from oliverm@matrix-media.com
>
>
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org