The question is: is it a good way of programming using the method addFieldError
OUTSIDE the validate method?
Suppose that:
my validate method only checks if some textfields are empty or not, and if they are, my
addFieldError
makes somefieldErrors
to show up.my execute method, after processed the login request by calling a method of the right Java Bean, knowing that the username and/or the password were incorrect, needs to call
addFieldError
with an appropriate error message.
Of course, that the execute method will return INPUT
in case of wrong username/password and SUCCESS
if Log in was successful.
Is this approach okay?