Make a counter and store into the database

解决方案 »

  1.   

    最简单的方法是用SESSION保存次数,每次提交之前判断是否次数超过了。没有超过则次数+1保存SESSION,超过了,弹出对话框
      

  2.   

    用session当用户关闭浏览器就可再试。
    建议用数据库,出错时累加至数据库,当登录成功时清除错误记录。
      

  3.   

    用一个static int errorCount = 0;错误一次就  errorCount++;如果 errorCount > 3;锁死   或者警告步知道你的程序用什么结构设计的。
      

  4.   

    zurong(★★★★★) 名字里面的星星是复制的还是用键盘敲出来,怎么敲出来
      

  5.   

    Session啦!!
    简单的代码,
      if (session.getValue("curLoginFailuerCount")==null)
      {
         session.putValue("curLoginFailuerCount",new Integer(0));
      }
      else if (((Integer) session.getValue("curLoginFailuerCount")).intValue>3)
      {
          out.write("<script language=javascript>alert('失败超过最大次数');</script>");
          return;
      }
    .....
      

  6.   

    我现在用jsp,用的是session,可是打印输出的数字不长!
      

  7.   

    经过研究写出的初步代码,请大家测试和借鉴:)
    Integer count = (Integer)session.getAttribute("COUNT");
    if( count == null ) {count = new Integer(1);
    session.setAttribute("COUNT", count);
    }
    else {count = new Integer(count.intValue() + 1);
    session.setAttribute("COUNT", count);
    }
    if(count.intValue() > 3)
    out.write("<script language=javascript>alert('失败超过最大次数')</script>");
      

  8.   

    zengchangliu(程序人生)
    ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
    敲出来了
    用智能ABC的v1  找找看哦