我想问一下如果用户名和密码输入超过一定次数,页面就自动锁死或弹出警告是怎么做的,谢谢! Make a counter and store into the database 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 最简单的方法是用SESSION保存次数,每次提交之前判断是否次数超过了。没有超过则次数+1保存SESSION,超过了,弹出对话框 用session当用户关闭浏览器就可再试。建议用数据库,出错时累加至数据库,当登录成功时清除错误记录。 用一个static int errorCount = 0;错误一次就 errorCount++;如果 errorCount > 3;锁死 或者警告步知道你的程序用什么结构设计的。 zurong(★★★★★) 名字里面的星星是复制的还是用键盘敲出来,怎么敲出来 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; }..... 我现在用jsp,用的是session,可是打印输出的数字不长! 经过研究写出的初步代码,请大家测试和借鉴:)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>"); zengchangliu(程序人生)★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★敲出来了用智能ABC的v1 找找看哦 ext struts2的问题 jsp 中我想判断来访IP,属于某段IP正常打开页面,不属于转向错误页面,怎么弄??? 二维表的分列统计的方法? 这样的错误!是mysql没链接上吗?大家来看看! 请教各位高手,Log4j.properties路径问题,进来看看 xqg1130(无名) 请进来~~~Help 用servlet添加cookie后又如何删除cookie呀?急! 请问如何用jsp打开一个Excel文件? spring properties配置文件 JXL导入excel 到数据库 的时候 能不能让 用户选择工作表? jsp出错问题。 终于离开公司了!散分!
建议用数据库,出错时累加至数据库,当登录成功时清除错误记录。
简单的代码,
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;
}
.....
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>");
★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
敲出来了
用智能ABC的v1 找找看哦