struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lesaint Sébastien <>
Subject RE: Help with validate ActionForm method
Date Mon, 14 Jun 2004 09:51:13 GMT
Hi Satish,

Problem is not related to validate="true" set on two actions, I've only one
in my whole struts-confif.xml file.

Any other idea?


-----Message d'origine-----
De : Satish Kataria [] 
Envoyé : lundi 14 juin 2004 10:09
À : Struts Users Mailing List; Lesaint Sébastien
Objet : RE: Help with validate ActionForm method

I hope you have not set validate="true" for the both the load and submit
action mapping
i.e there wld be a action mapping for loading the screen(say load) The
validate attribute for this action
Be set to false

Then there wld be a action maqpping when to want to validate(say on submit
of a button - lets call it submitaction). The validate attribute of only
this shld be set to true


-----Original Message-----
From: Lesaint Sébastien [] 
Sent: Monday, June 14, 2004 1:19 PM
To: Struts Users Mailing List
Subject: Help with validate ActionForm method


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

    if (errors.isEmpty()) {
      if (!isConnected(login, password)) {
        errors.add("login", new

    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 []
09:26:54,587 INFO  [lex.LoginActionForm] Failed attempt to log in : [/] from

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 ????



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

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