I found a valid (for me) reason to choose redirection over forwarding.

As part of switching to using cookies for user tracking ...

When setting a cookie in an action, I was orginally forwarding to the
next page and then wondering why I couldn't see the cookie that I had
just set. This is because there had been no round-trip back to the
browser to set the cookie and then send it when it requested the next
page. So in my action I directed the returned actionforward to use
redirection and while it is a little less efficient for that one page
transition, I do now get my cookie set and am able to read it in the
next page.

The moral of this story is that most of the time you'll likely want to
use forwarding, but there WILL be times/reasons to use redirection.

I hope that this helps.

Simon

-----------------------------------------------------------------
Simon P. Chappell                     [EMAIL PROTECTED]
Java Programming Specialist                      www.landsend.com
Lands' End, Inc.                                   (608) 935-4526


>-----Original Message-----
>From: Brian Holzer [mailto:[EMAIL PROTECTED]]
>Sent: Thursday, January 24, 2002 2:46 PM
>To: [EMAIL PROTECTED]
>Subject: redirect vs forward
>
>
>Hey there,
>    I am kind of confused about what the difference is between 
>a forward and a redirect.  In reading the documentation on the 
>logic:forward and redirect tags. With the forward tag, whether 
>a forward or redirect is sent, is determined by the redirect 
>param in the <action> definition. The redirect tag sends a 
>redirect to the browser, but what is the difference between 
>the two?  Why would I want to define an Actions forward so 
>that it is sent as a redirect?  Maybe the answer will be 
>evident to me once I know the difference b/t the two.  Can 
>someone shed some light on this for me?
>
>Brian
>
>
>--
>To unsubscribe, e-mail:   
><mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail: 
><mailto:[EMAIL PROTECTED]>
>
>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to