struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Par Winzell <>
Subject using redirecting forwards after failed validation
Date Wed, 17 Dec 2003 17:40:46 GMT
Hello everyone -- this is my first post. I'm hoping you can help with a
problem. I've seen bits and pieces of this question asked, but not

Here's my problem:

When the user enters data into a 'enter search parameters' form and
validation fails, I don't want the URL to proceed to the 'perform the
search' action. This means I have to use redirecting forwards for the
'input' attribute.

However, with redirects... if I understand correctly... it's not good
enough to store validation errors in the request attributes. They need
to go into session scope. My problem is figuring out where this should

Experimentally, I now mask validate(), which basically does

  errors = super.validate();
  request.getSession().setAttribute(ERROR_KEY, errors);
  return errors;

but this feels rather nasty to me; validate() is supposed to return
values, not cause side-effects... right?

The problem is that is entirely atomic all the way
from calling validate() to performing the redirect. Is there some other
way to do this that I'm missing? ... or should I not be doing what I'm
doing? Is there some other way to get redirection to work, with the
validator framework?

Appreciate any help --

Par Winzell
Madison, WI

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

View raw message