I've noticed a potential problem with the way errors are handled, and the
ErrorsTag class. I'm assuming I'm missing something. (I'm new to Struts)

Picture the following:

A jsp page, login.jsp. It has a form.
An action class, LoginAction.java.
A form class, LoginForm.java.

LoginAction does exactly what you would expect. It checks the database for
the user and password. If the user or password is invalid, it loads a
message into errors, and then calls saveErrors() in ActionBase.

The difference in what I'm doing vs. the Struts examples is that, rather
than using forward functionality to return back to login.jsp on errors, I'm
using redirect instead. I don't want the URL in the browser to be login.do.

You see the problem. Errors are stored to the request context, which is no
longer valid after the redirect, therefore the errors tag can not retrieve
the errors.

I would suggest that session context should be used for the errors tag for
cases just like this, although that causes problems as well. The problem
will be, when does it get removed from the session?

Is there another way to accomplish the same thing, without tacking the error
on to the redirect URL?

Thanks,
Doug

---------------------------------------------------
Doug Ahmann
Macromedia, Inc.
(612) 840-9544

Reply via email to