On Thursday 15 April 2004 11:30, Mu Mike wrote:

Simple 'rule of thumb': whenever possible, use
a forward. Use redirects only if:

1. You've reached the end of a processing chain
and want to leave the user at a determined
application state, a point from which he may
start another interaction with the application,
but everything else is done and finished.
Such as redirecting to the starting page
after a 'wizard' has completed.

2. Interaction with external systems, such
as a payment system provider who
chose Perl, PHP or Microsoft for their
implementation. Well, to be honest;
even if it were Java, it would make no 
difference here, Once you leave your
server | JVM, all the benefits of the 
Servlet API are gone for good from
your perspective, and there's no
way to get around it.

Why? After a redirect, the request isn't
the same anymore. The server simply
issues a status code that tells the
browser to try again at the given URL,
and if the user hasn't disabled this
feature (which is possible in some
browsers), it will go there automatically.
But in any case, this ends up in an entirely
new request. Where in a forward you
have all the power of the Java Server
in your back, in a redirect situation
you're doomed to passing any infor-
mation by HTTP means, namely by
parameters. Sometimes, that's
necessary, harmless or even intended
(a redirect updates the browser
command line, so the user knows
where he is again), but whenever
possible, use forwards. 

May the server be with you, and 

HTH,
-- Chris.  

> when forward, what do we foward?
> when redirect, what we do different?
>
> Thanks&Regards
> Mike

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

Reply via email to