struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claire Wall" <>
Subject Re: forward vs redirect ?
Date Mon, 01 Dec 2003 13:59:22 GMT
Hi Antony,

As a rule i always use just forward unless there is a specific need to
redirect to the page you're forwarding to.

For example, say i had an action which saved some details from a form to a
database. if the page is not redirected then if the user were to refresh the
page, the action would be called again and the data saved again. This
obviously i would not want the user to do so in this case i redirect the
page, so that if the user were to refresh the page, the save action would
not be called again.

The times when I would advise against using redirecting is when you're
storing objects on the request object in your action. If you redirect then
this information is lost. There are ways around this (like putting the
objects on the session rather than on the request object) but i try to cut
down on the amount of information being stored in the session.

There are probably some better defined uses of the redirect attribute and
when/where to use it, but the above is the general rules i go by, having run
into problems with both redirecting and not redirecting in the past.

hope this helps


----- Original Message -----
From: "Antony Paul" <>
To: "struts" <>
Sent: Monday, December 01, 2003 1:28 PM
Subject: forward vs redirect ?

> Hi,
>     I would like to receive comments on when to use forward and redirect
> action mapping. Do people use forward only. All the articles and examples
> saw uses forward.
> Antony Paul.
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message