Hi,

I have an ActionForm like following, the setter got called while validate
method never, why?

public class MyForm extends ActionForm {

    private String username;
    private String password;

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
        System.out.println(username);
        System.out.println("setuserName");
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public MyForm() {
    }

    public void reset(ActionMapping actionMapping, ServletRequest
servletRequest) {
        super.reset(actionMapping, servletRequest);    //To change body of
overridden methods use File | Settings | File Templates.
    }

    public ActionErrors validate(ActionMapping actionMapping, ServletRequest
servletRequest) {

        System.out.println("validateing");
        ActionErrors errors = new ActionErrors();
        errors.add("test", new ActionMessage("test"));
        return errors;
      //  return super.validate(actionMapping, servletRequest);    //To
change body of overridden methods use File | Settings | File Templates.
    }

the struts-config.xml as follows:

<struts-config>
    <form-beans>
        <form-bean type="pkg.MyForm" name="loginForm"/>
    </form-beans>
    <global-forwards>
        <forward path="/pages/login.jsp" name="login"/>
    </global-forwards>
    <action-mappings>
        <action path="/login" scope="request" type="pkg.MyAction"
name="loginForm" validate="true"
                input="/pages/errors.jsp"/>
    </action-mappings>
</struts-config>

}
-- 
View this message in context: 
http://www.nabble.com/validate-never-got-called-tf4284786.html#a12196967
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to