struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hubert Rabago <jakartau...@yahoo.com>
Subject Re: forward vs redirect ?
Date Mon, 01 Dec 2003 15:37:58 GMT
Anthony,

I use redirect to separate actions which do work and actions which display
information.
Let's say I have 2 pages/Action objects:  DisplayItem, ProcessBid.
The user sees an item he likes (say displayItem.do?id=123) and enters a bid.  The
bid will get submitted to processBid.do.  Once ProcessBid is finished, it will
redirect to displayItem.do?id=123 which will show the item and (at this point)
the updated bid amount.  

The advantages are these:
* My "process" action (and any other action which does processing) doesn't need
to chain the display action.
* The user can refresh the resulting page without me having to worry about any
form getting processed twice. (this is a real ebay problem, by the way, and kinda
sucks when you're entering a bid at the last minute and need up-to-the-second
updates)
* The url of the resulting page is preserved, allowing the user to bookmark it or
forward it if he so desired.  (Not too helpful for the auction example, but think
about "New Record" processing where you show a page which displays a newly
entered record.)

HTH,

Hubert

--- Antony Paul <antonypaul24@hotmail.com> wrote:
> Hi,
>     I would like to receive comments on when to use forward and redirect in
> action mapping. Do people use forward only. All the articles and examples I
> saw uses forward.
> 
> Antony Paul.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/

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


Mime
View raw message