jsp页面限制登录 jsp登录页面中当用户错误登录三次以后,再登录就跳的别的页面。这个代码怎么写? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 在Session中持有一个错误登录次数计数器,第4次登录的时候,forward或redirect到别的页面。正确登录的时候,计数器清零或remove 在请求的jsp页面,或servlet,或action里,用session记录登录的次数,再判断 public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { HttpSession session=request.getSession(); boolean bool=你的登录方法(); if(bool) return mapping.findForward("index"); else { int i=1; if(session.getAttribute("count")!=null) i=Integer.parseInt(session.getAttribute("count").toString()); if(i>3) return mapping.findForward("error"); else { session.setAttribute("count",i) return mapping.findForward("login"); } } } hibernat条件查询 怎样在不重新刷新项目,不停止tomcat的情况下更新项目 初学ajax的郁闷....小问题啊!散分啊!O(∩_∩)O~ SESSION值丢失问题 struts2 标签问题 如何给JSP后台写的网站添加一个前台修饰 简单一问,参数传递的错误 再问一个一直想问的关于jsp的问题 创建txt时URL的问题 SSH,连接过多问题Too many connections 真的理解接口了吗? 大虾,谁能告诉我怎么解决呢?急急急,在线等
正确登录的时候,计数器清零或remove
HttpServletRequest request, HttpServletResponse response)
{
HttpSession session=request.getSession();
boolean bool=你的登录方法();
if(bool)
return mapping.findForward("index");
else
{
int i=1;
if(session.getAttribute("count")!=null)
i=Integer.parseInt(session.getAttribute("count").toString());
if(i>3)
return mapping.findForward("error");
else
{
session.setAttribute("count",i)
return mapping.findForward("login");
}
}
}