package chat2;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionMessage;

public class LoginActionForm extends ActionForm {
    private String password;
    private String userName;
    public String getPassword() {
        return password;
    }

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

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getUserName() {
        return userName;
    }

    public ActionErrors validate(ActionMapping actionMapping,
                                 HttpServletRequest httpServletRequest) {
            /** @todo: finish this method, this is just the skeleton.*/
            ActionErrors errors=new ActionErrors();
            if(password.length()<8)
                     {
                      errors.add(ActionErrors.GLOBAL_MESSAGE,new ActionMessage("error.passwordlength"));
                       }
                     return errors;

    }

    public void reset(ActionMapping actionMapping,
                      HttpServletRequest servletRequest) {
    }
}
