现在是这样一个情况,左边的FRAME是菜单,含有很多链接,右边的FRAME是点击链接后显示的内容(就像CSDN论坛一样),现在要做的是,当SESSION有效的情况下,点链接可以正常显示右边的内容,但是当SESSION失效的情况下,返回单独一个LOGIN画面,由于现在链接的TARGET指定的是右边的FRAME,所以现在即使返回到LOGIN画面也是显示在右边,不知道有什么办法可以解决?

解决方案 »

  1.   

    这个很容易啊用javascript的 parent.window.location.href="login.html"parent指父窗口,也就是你要的不是某一个框架,是整个页面。
      

  2.   

    你可以用这句试下:
    window.open("<%=request.getContextPath()%>/login.do","_parent","");
      

  3.   

    <script language="javascript">
    window.top.location.href="http://www.china.com";
    </script>
      

  4.   

    比如我现在是<a href="xxxx.jsp" target="right">test</a>
    这里怎么用js?
      

  5.   

    frameset.htm
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>Untitled Document</title>
    </head><frameset cols="*,*" frameborder="YES" border="2" framespacing="2">
      <frame src="left.htm" name="leftFrame" >
      <frame src="right.htm" name="mainFrame">
    </frameset>
    <noframes><body>
    </body></noframes>
    </html>left.htm
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>Untitled Document</title>
    </head><body>
    <!--当然这里要先看session-->
    <a href="#" onclick="window.open('login.html','_parent','');">111</a>
    <br><a href="#" onclick="window.open('login.html','mainFrame','');">222</a>
    </body>
    </html>
      

  6.   

    页中加这么一段话<%
    if(session.getAttribure("你的属性")==null){
    >%
    <script>
    window.open("login.jsp","_parent","");
    </script>
    <%
    }
    %>或者写一个checksession.jsp在每个页中include
      

  7.   

    楼上两位的方法我也想过,但是进入页面的时候java代码已经进行过判断了,刚进入页面的时候可能session的确有效,但是如果不点击,等时间经过后session无效了,此时再点击的话执行的js代码还是session有效时判出来的链接,所以还是不行呢
      

  8.   

    在Login.jsp中加上这句话:
    <script language="javascript">
    if (top.location !== self.location){
    top.location=self.location;
    }
    </script>
      

  9.   

    在Login.jsp中加上这句话:
    <script language="javascript">
    if (top.location !== self.location){
    top.location=self.location;
    }
    </script>
    这样当Login.jsp发现它的上面是框架的时候就会自动跳出,我写的程序都是这样的
      

  10.   

    <script language="javascript">
    parent.window.location.href="login.html"
    </script>
      

  11.   

    用了isloop(isloop)兄的方法通过了,非常感谢,也谢谢参与的所有人,人人给分!