⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 debugloginactionform.java~33~

📁 一个基于JAVA的BS结构的宠物诊所管理系统.是当年在学校时写的,大家指点一下.
💻 JAVA~33~
字号:
package gxaccp.t07.guoneng_wei.petclinicmanagesystem.beans;

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.ActionError;

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

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

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

  public String getUserName() {
    return userName;
  }

  public ActionErrors validate(ActionMapping actionMapping,
                               HttpServletRequest request) {
    /** @todo: finish this method, this is just the skeleton.*/
    String uName = request.getParameter("userName");
    String pswd = request.getParameter("password");
    boolean flag=false;
    ActionErrors errors=new ActionErrors();
    if (uName != null && !"".equals(uName)) {
      errors.add("userNameState",new ActionError("用户名要填写"));
      flag=true;
    }
    if ( pswd != null && !"".equals(pswd)) {
      errors.add("userPasswordState",new ActionError("密码要填写"));
      flag=true;
    }
    if(flag){
      return errors;
    }
    return null;
  }

  public void reset(ActionMapping actionMapping,
                    HttpServletRequest servletRequest) {
    password = "";
    userName = "";
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -