//验证代码@Override public void validate() { //用户名不能为空 if("".equals(u.getUsername())){ this.addFieldError("usernameError", "用户名不能为空!"); } if(u.getPassword().length()<6){ this.addFieldError("password", "密码长度不能少于6位!"); } }//登录方法@SkipValidation public String login(){ UsersDao udao=new UsersDaoImpl(); if(udao.usersLogin(u)){ //在session中保存 session.setAttribute("loginUserName", u.getUsername()); return "login_success"; }else return "login_failure"; }//struts配置<package name="users" namespace="/users" extends="default"> <action name="*_*" class="action.{1}Action" method="{2}"> <result name="input">/users/Users_login.jsp</result> <result name="login_success">/users/Users_login_success.jsp</result> <result name="login_failure">/users/Users_login.jsp</result> <result name="logout_success">/users/Users_login.jsp</result> </action> </package>有哪里有问题吗
1 回答
添加回答
举报
0/150
提交
取消