out.println("<script>window.open('myOpened.jsp');</script>");
在jsp里用这句话可以打开一个网页,但是网页是不断刷新的,每次刷新都要重新打开一个,
但是我的本意是,如果原来这个网页是关闭状态的,刷新的时候重新打开一个,如果该网页已经是打开的状态了,就不再执行这个命令了,该怎么来 判断呢?
如果是swing的就好做了,首先判断frame的isvisable()如果是fasle就frame.setvisable(true);
但是网页该怎么处理啊?这个可以判断visable属性吗?

解决方案 »

  1.   

    用session来控制吧?
    如果打开了就在session给个值.
    然后根据session来判断是否打开过~~
      

  2.   

    <%@ page language="java" import="java.util.*" pageEncoding="gb2312"%> 
    <% 
    String path = request.getContextPath(); 
    String basePath = request.getScheme() + "://" 
    + request.getServerName() + ":" + request.getServerPort() 
    + path + "/"; 
    %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 
    <html> 
    <head> 
    <base href=" <%=basePath%>"> <title>My JSP 'index.jsp' starting page </title> 
    <meta http-equiv=refresh content="3; rl=#"> <meta http-equiv="pragma" content="no-cache"> 
    <meta http-equiv="cache-control" content="no-cache"> 
    <meta http-equiv="expires" content="0"> 
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> 
    <meta http-equiv="description" content="This is my page"> 
    <!-- 
    <link rel="stylesheet" type="text/css" href="styles.css"> 
    --> 
    </head> 
    <body> 
    fhis is my JSP page. 
    <br> 
    <% 
    out.println("成功了");
    out.println("<script>window.open('jsp1.jsp);</script>");
    %> 
    </body> 
    </html>
    拿这个做个例子演示下好吗?
      

  3.   

    你最好把刷新写在本画面(myOpened.jsp)。然后target都是一个不就可以了吗?
      

  4.   

    你可以使用跳转。没有不要使用js的window.open()
    你可以说一下,你的要求。
      

  5.   

    out.println(" <script>window.open('jsp1.jsp',''newwindow''); </script>"); 
      

  6.   

    out.println(" <script>window.open('jsp1.jsp','mm'); </script>"); 
      

  7.   

    out.println(" <script>window.open('myOpened.jsp','aaaaa'); </script>"); 
    这样就可以,至少在IE里面就可以了