logonform.java~3~

来自「100多M的J2EE培训内容」· JAVA~3~ 代码 · 共 35 行

JAVA~3~
35
字号
package firststrut;import org.apache.struts.action.*;import javax.servlet.http.*;public class LogonForm extends ActionForm {  private String password;  private String username;  public void setPassword(String password) {    this.password = password;  }  public String getPassword() {    return password;  }  public void setUsername(String username) {    this.username = username;  }  public String getUsername() {    return username;  }  public ActionErrors validate(ActionMapping actionMapping, HttpServletRequest request) {    /**@todo: finish this method, this is just the skeleton.*/    ActionErrors errors=new ActionErrors();    if(request.getParameter("username").equals("lsb")&& request.getParameter("password").equals("bsl")){     errors=null;     request.setAttribute("loginattem",new Boolean(true));    }else{      errors.add(username,new ActionError("invalid user"));      request.setAttribute("loginattem",new Boolean(false));    }    return errors;  }  public void reset(ActionMapping actionMapping, HttpServletRequest httpServletRequest) {  }}

⌨️ 快捷键说明

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