package userstruts;

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

public class UserActionForm
    extends ActionForm {
  public UserActionForm() {
    try {
      jbInit();
    }
    catch (Exception ex) {
      ex.printStackTrace();
    }
  }

  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) {
    ActionErrors errors=new ActionErrors();
 if((userName==null)||(userName.equals("")))
 { errors.add(ActionErrors.GLOBAL_MESSAGE,new ActionError("error.name"));}
 if((password==null)||(password.equals("")))
 { errors.add(ActionErrors.GLOBAL_MESSAGE,new ActionMessage("error.password"));}
 return errors;

  }

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

  private void jbInit() throws Exception {
  }
}
