求助:filter成了死循环了,怎么办呀? response.sendRedirect("index.jsp"); 第二次请求又进入了filter 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 String name=(String)session.getAttribute("name"); if(null==name) { response.sendRedirect("index.jsp"); }else { chain.doFilter(req, res); } 修改成为下面的代码:Object obj= session.getAttribute("name"); if(null==obj) { response.sendRedirect("index.jsp"); return;}chain.doFilter(req, res); 支持,楼主可以把index.jsp排除 if((null==name) && !("index.jsp".equals(req.getContextPath()+req.getServletPath()))) { response.sendRedirect("index.jsp"); }else { chain.doFilter(req, res); } if((null==name) && !("/index.jsp".equals(req.getContextPath()+req.getServletPath()))) { response.sendRedirect("index.jsp"); }else { chain.doFilter(req, res); } 我怀疑是你 index.jsp 里面是不是<script> window.loaction.href =''; </script>或<% request.setRedirect(''); 或 request.forward(''); 等等啊%>什么的啊 response.sendRedirect("index.jsp"); 改成...RequestDispatcher dispatcher = request.getRequestDispatcher("index.jsp"); dispatcher.forward(request, response); 或者调用一个action返回到index.jspRequestDispatcher dispatcher = request.getRequestDispatcher("index.do"); dispatcher.forward(request, response); 我怀疑是你 index.jsp 里面是不是 有<script> window.loaction.href =''; </script> 或 <% request.setRedirect(''); 或 request.forward(''); 等等啊 %> 什么的啊 .我从2005年用到现在还没出现过,你这样的问题 如果你的连接不是登陆表单的地址且session取到的内容为空,那么转向表单地址否则,如果地址是用来登陆的,那么就doFilter 关于DTREE和iframe的用法 在非IT企业做了4年开发,现在很迷茫款或,和外面差距好大,该如何提高? JSP如何对外发布 Servlet无法再一次插入新值到数据库里? 在线求救~~~(急)(100) 大家帮我看看这是怎么回事,用代码总是连接不上! JSP中bean中返回的值无法显示为中文 session 问题 如何在JSP中调用存储过程? 连接Oracle8i,tomcat报Driver Error,为什么? JAVA n行n列数,每行都有最大数,如何求这些最大数中最小的 Eclipse3.4+Strust2配置问题. 在线急等。
if(null==name)
{
response.sendRedirect("index.jsp");
}else
{
chain.doFilter(req, res);
} 修改成为下面的代码:
Object obj= session.getAttribute("name");
if(null==obj)
{
response.sendRedirect("index.jsp");
return;
}chain.doFilter(req, res);
{
response.sendRedirect("index.jsp");
}else
{
chain.doFilter(req, res);
}
{
response.sendRedirect("index.jsp");
}else
{
chain.doFilter(req, res);
}
里面是不是
<script>
window.loaction.href ='';
</script>
或
<%
request.setRedirect('');
或
request.forward('');
等等啊
%>
什么的啊
改成...
RequestDispatcher dispatcher = request.getRequestDispatcher("index.jsp");
dispatcher.forward(request, response);
或者调用一个action返回到index.jsp
RequestDispatcher dispatcher = request.getRequestDispatcher("index.do");
dispatcher.forward(request, response);
我怀疑是你 index.jsp
里面是不是 有
<script>
window.loaction.href ='';
</script>
或
<%
request.setRedirect('');
或
request.forward('');
等等啊
%>
什么的啊 .
我从2005年用到现在还没出现过,你这样的问题
否则,如果地址是用来登陆的,那么就doFilter