关于response.sendRedirect的问题?
我在一个JSP页面会检验用户是否已经登陆,我用的方法是
Check.jsp
<%
String logined=(String)session.getAttribute("logined");
if(logined==null && !logined.equals("true"))
response.sendRedirect("noLogin.html");
%>
<html>
<body>
<h1 align="center">Welcome<h1>
</body>
</html>
注:logined这个session变量我已经在Check.jsp的上个页面设置了。
可是,当我将Tomcat服务器shutdwon,然后startup,在刷新Check.jsp,
这时怪事情出来了,在IE页面上:上部分是Check.jsp的内容,下部分是noLogin.html的内容,我真的搞不懂这是为什么!!!
还有,我将
if(logined==null && !logined.equals("true"))
response.sendRedirect("noLogin.html");
改为
if(logined==null && !logined.equals("true"))
<%
{
%>
<jsp:forward page="noLogin.html" />
<%
}
%>
页面居然半天出不来!!!