tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: Race condition with values displayed across redirects
Date Thu, 04 Oct 2007 15:48:54 GMT
Hash: SHA1


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
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla -


To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message