放session 货cookie里面 后台判断有三次就调用锁定帐号的服务

解决方案 »

  1.   

    没有写过,但是感觉可以在user这个类中添加一个private int wrongPassword = 0;变量 和一个 private boolean isActive = true;变量,每错一次密码进行 setwrongPassword() 操作,当wrongPassword ==3的时候,setIsAction=false ,然后再添加一个内部类来实现账号锁定。 个人观点。
      

  2.   

    连输三次是指同一天吗?要不你把数据保存到内存中,然后定时清除过时的数据,如果从性能方面考虑,我倒觉得ajax去访问数据库好点。
      

  3.   

    oracle的登录实现的不错,可以参考;
      

  4.   

     public String Login() throws Exception{
            User u=userdao.findByName(user);        
            int LoginTimes=0;
            Integer o=(Integer)ServletActionContext.getContext().getSession().get("LT");
            if(o!=null){
            LoginTimes=o;
            }
            if(u.getPassword().equals(user.getPassword())){                      
            return SUCCESS;
            }else{
            LoginTimes++;
            ServletActionContext.getContext().getSession().put("LT",LoginTimes);
            System.out.println(LoginTimes);
            if(LoginTimes==3){
                ServletActionContext.getContext().getSession().put("LoginTimes", "您已经连续三次登录失败,账户已锁");
                }
            return INPUT;
            }        
           }