-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Mark,

Mark Thomas wrote:
> lightbulb432 wrote:
>> I have a question about whether there is a race condition with the following
>> technique for displaying messages across redirects.
> 
> Yes there is.
> 
>> If you submit a form with an invalid value on page P1 and the receiving
>> servlet S redirects to another page P2, you'd like page P2 to contain a
>> message saying "You entered an invalid value". You can only put the value in
>> the session (not the request, because it's a redirect, not a forward), with
>> session.setAttribute("message","You entered an invalid value").
> 
> Why not pass the information to P2 using a request parameter on the
> redirect?

Or, better yet, why use a redirect at all? Then you don't have to mess
with the session. Most post/validate/error flows I've seen all execute
within the same request. Don't respond with a redirect; just redisplay
the input form with the error messages attached. Then you don't have to
worry about cleaning-up the session.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHBQtm9CaO5/Lv0PARAuSDAKChcVQ0+gSaJFR2AiS0mkUSx/DQkACfQTiz
tuGGrkCrYACJNp9QH6r87Ro=
=Kl2o
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to