> The validation works fine however, when I just type the
http://localhost:8080/login.do
> in my browser (no submit), the validation error will show up at once.
> I understand that it's just like I submit a form to login.do action
without any
> parameter. My question is, do struts provide any simple method to
avoid this and just
> show no error message?
There's a few different ways to handle this problem.
1) 2 action mappings -- 1 with validation turned off (welcome.do) and 1
with it on (login.do).
2) Turn validation off, and handle that in the action:
login.do
if (isSubmitted) {
errors = form.validate()
// redirect or do other authenticate work
} else {
return mapping.findForward("login");
}
HTH,
Dave
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]