You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Dave Belfer-Shevett <db...@homeport.org> on 2009/02/16 23:23:31 UTC

Simple redirect, OFF-site.

Hey folks, I was just searching the archives (lots of requests for 
redirects, but not one similar to what I need).

I'm implementing a Paypal payment gateway, which requires an HTTP call to 
get a URL from a remote webservice, then I need to redirect the user to 
that URL.

I have the URL (that part is all coded), now all I need to do is redirect 
the users browser to http://something.paypal.com/someparameter.

In scriptlet mode, I'd just do:
<%
 	String redirectURL = "http://something.paypal.com/someparameterB";
 	response.sendRedirect(redirectURL);
%>

To do this in the struts-way I'd need to make my action responseaware and 
feed data into it.  I'd rather just do something like

String target = "http://somewhere.paypal.com/";
return "redirect";

then in struts.xml
<result name="redirect"  type="redirect-action" 
"/WEB-INF/jsp/Redirect.jsp"/>

and have my Redirect.jsp have a ${target} in it

How to do this?  In short, how do I have a struts action redirect the 
users browser to an arbitrary (off-site) URL?

 	-dbs

-- 
-------------------.--------.-------------------------------.
Dave Belfer-Shevett \ KB1FWR \ JID: dbs@jabber.stonekeep.com \
blog:planet-geek.com >--------'-----------------------------------.
dbs@homeport.org    /  7. Twelve-ounce pound cake. (from 'Top 50   \
-------------------<                  Oxymorons')                   |
                     \______________________________________________/

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


Re: Simple redirect, OFF-site.

Posted by Dave Belfer-Shevett <db...@homeport.org>.
On Mon, 16 Feb 2009, Musachy Barroso wrote:
> See this page:
>
> http://struts.apache.org/2.x/docs/parameters-in-configuration-results.html
>
> use "redirect", instead of "redirectAction" for the result type.

That did it, thanks.

 	-d
-- 
-------------------.--------.-------------------------------.
Dave Belfer-Shevett \ KB1FWR \ JID: dbs@jabber.stonekeep.com \
blog:planet-geek.com >--------'-----------------------------------.
dbs@homeport.org    /  I intend to live forever-so far, so good.   \
                     \______________________________________________/

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


Re: Simple redirect, OFF-site.

Posted by Musachy Barroso <mu...@gmail.com>.
See this page:

http://struts.apache.org/2.x/docs/parameters-in-configuration-results.html

use "redirect", instead of "redirectAction" for the result type.

musachy

On Mon, Feb 16, 2009 at 5:23 PM, Dave Belfer-Shevett <db...@homeport.org> wrote:
> <result name="redirect"  type="redirect-action"
> "/WEB-INF/jsp/Redirect.jsp"/>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

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