struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lesaint S├ębastien <lesa...@ginlex.com>
Subject Help with validate ActionForm method
Date Mon, 14 Jun 2004 07:49:22 GMT
Hi,

I'm using ActionForm for one of my pages and I implemented the validate
method as follow:
public ActionErrors validate(ActionMapping mapping,
                               HttpServletRequest request) {
    ActionErrors errors = new ActionErrors();

    if (isFieldEmpty(login)) {
      errors.add("login", new ActionError("loginForm.login.required"));
    }

    if (isFieldEmpty(password)) {
      errors.add("password", new
ActionError("loginForm.password.required"));
    }

    if (errors.isEmpty()) {
      if (!isConnected(login, password)) {
        errors.add("login", new
ActionError("loginForm.msgs.wrongLoginorPassword"));
      }
    }

    if (!errors.isEmpty()) {
      getLogger().info(this, "Failed attempt to log in : [" + login + "/" +
password + "] from : " + request.getRemoteHost());
    }
    return (errors);
 }

You can see that I log each time someone fail to log in.
When the validate method returns an empty Error Array, login/password are
checked in an Action object.

The problem is that I have the following trace in the log when somebody
successfully log in :
09:26:54,500 INFO  [lex.LoginAction] User logged in [login/pwd] sessionId
[773BB4634682A159DC680847073E4EC8] from [10.10.10.10]
09:26:54,587 INFO  [lex.LoginActionForm] Failed attempt to log in : [/] from
: 10.10.10.10

These traces obiviously means that the validate method is called twice, the
second time the ActionForm having empty fields.

Does anybody know why such a thing would happen ????

Thanks

-- 
Seb'

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message