环境:
win2k+tomcat5.5.17+jdk1.5+MyEclipse5.0M2
问题内容:
现在有一个框架的网页,有顶部,左部和main窗口组成,框架网页的代码如下:
<frameset rows="110,*" Border="0" bordercolor="#6e3953">
<frame name="banner" scrolling="no" noresize target="contents" src="top.htm">
<frameset cols="189,83%">
<frame name="contents" target="main" src="left.jsp">
<frame name="main" src="main.htm">
</frameset>
<noframes>
我得问题是:
系统的所有内容都需要通过tomcat安全域的验证,安全域的验证通过login.jsp,验证成功后,将当前的用户保存到session中,然后可以访问系统的内容,现在验证成功了,过了20分钟后,session过期
,然后我点击了网页上的一个连接,系统自动调用的login.jsp,不过此jsp文档在框架窗口的main窗口中打开的,而我希望,这时候应当直接出现login.jsp,而不是在main窗口中打开,这样的技巧应当如何做
win2k+tomcat5.5.17+jdk1.5+MyEclipse5.0M2
问题内容:
现在有一个框架的网页,有顶部,左部和main窗口组成,框架网页的代码如下:
<frameset rows="110,*" Border="0" bordercolor="#6e3953">
<frame name="banner" scrolling="no" noresize target="contents" src="top.htm">
<frameset cols="189,83%">
<frame name="contents" target="main" src="left.jsp">
<frame name="main" src="main.htm">
</frameset>
<noframes>
我得问题是:
系统的所有内容都需要通过tomcat安全域的验证,安全域的验证通过login.jsp,验证成功后,将当前的用户保存到session中,然后可以访问系统的内容,现在验证成功了,过了20分钟后,session过期
,然后我点击了网页上的一个连接,系统自动调用的login.jsp,不过此jsp文档在框架窗口的main窗口中打开的,而我希望,这时候应当直接出现login.jsp,而不是在main窗口中打开,这样的技巧应当如何做
kenees(飞跃巅峰)你好,这种情况如何在web.xml中加filter呢,能否说的详细点,谢谢
please do google
top.location.href ="login.jsp" //框架的最顶层窗口地址定向到login.jsp
</script>
import javax.servlet.http.*;
import java.io.*;
import java.util.*;public class LoginCheckFilter
extends HttpServlet implements Filter
{
private FilterConfig filterConfig;
//Handle the passed-in FilterConfig
public void init(FilterConfig filterConfig)
throws ServletException
{
this.filterConfig = filterConfig;
} //Process the request/response pair
public void doFilter(ServletRequest request, ServletResponse response
, FilterChain filterChain)
{
try
{
//进行请求和响应的类型转换
HttpServletRequest httpRequest = (HttpServletRequest) request;
HttpServletResponse httpResponse = (HttpServletResponse) response; boolean isValid = true;
String uriStr = httpRequest.getRequestURI().toUpperCase(); if (uriStr.indexOf("LOGIN.JSP") == -1 &&
uriStr.indexOf("SWITCH.JSP") == -1 &&
httpRequest.getSession().getAttribute("ses_userBean") == null)
{
isValid = false;
}
if (isValid)
{
filterChain.doFilter(request, response);
} else
{
httpResponse.sendRedirect("/webModule/login.jsp");
}
} catch (ServletException sx)
{
filterConfig.getServletContext().log(sx.getMessage());
} catch (IOException iox)
{
filterConfig.getServletContext().log(iox.getMessage());
}
} //Clean up resources
public void destroy()
{
}
}MSN:[email protected]
<script>
top.location.href ="login.jsp" //框架的最顶层窗口地址定向到login.jsp
</script>
if(uid==null){
out.print("<script>parent.window.location='/login.jsp';</script>");
}
没试过在多层框架下能不能到IE的最顶部窗口??