如果你是固定每5秒就刷新一次,可以直接在
<head>
</head>
直接加一个
<meta http-equiv="refresh" content="5">

解决方案 »

  1.   

    或者改成下面的方式看看:index.jsp
    ***********************************
    <%@ page contentType="text/html; charset=GBK" %>
    <html>
    <head>
    <title>
    index
    </title>
    </head>
    <body bgcolor="#ffffff"><script language="JavaScript">
    function timer(){
    //redirect to another page
    var TmpStr = "../test/test.jsp";
    var ret =window.showModalDialog(TmpStr,null,"status:no;dialogTop:"+(window.screen.height/2-50)); if(ret.status==1){
                            document.write("<A href="+ret.value+">搜狐</A>");
                            document.location.reload();
    }
    if(ret.status==0){
                            document.write("<A href="+ret.value+">新浪</A>");
                            document.location.reload();
                    }
    setTimeout(timer,5000);}timer();</script></body>
    </html>
      

  2.   

    1.
    var TmpStr = "../test/test.jsp?temp="+ Math.random(); //阻止客户端的缓存2. test.jsp:
    //禁用客户端缓存
    HTML
        <META HTTP-EQUIV="pragma" CONTENT="no-cache">
        <META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate">
        <META HTTP-EQUIV="expires" CONTENT="Mon, 23 Jan 1978 12:52:30 GMT">
    JSP
        response.setHeader("Pragma","No-Cache");
        response.setHeader("Cache-Control","No-Cache");
        response.setDateHeader("Expires", 0);