<meta http-equiv="refresh" conten=3;url=addDepartment.do/>
在页面里加上这句,依照各人情况不同,content是时间!

解决方案 »

  1.   

    在<head>和</head>之间添加一个META标记,如下所示
    <meta http-equiv="refresh" conten=3;url=跳转页面的路径/>
    把"跳转页面的路径"改成你要跳转的路径,可以是相对路径,也可以是绝对路径。
    "conten=3"表示3秒钟后跳转。 
      

  2.   

    用javascript也可以实现3秒之后自动跳转
      

  3.   

    我加了怎么不行啊

    <%@ page language="java" import="java.util.*" pageEncoding="GBK"%>
    <%
    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 'test1.jsp' starting page</title>
        
    <meta http-equiv="refresh" content=3 ;url=http://mail.163.com/>
      </head>
      
      <body>
        This is my test1 page. <br>
        <% String str=(String)session.getAttribute("lzw"); %>
        <%if (str==null){ %>The JSPtest1-test1 Page is null
        <%}else{ %>The JSPtest1-test1 Page is  <font color="#ff0000">not</font> null<%} %>
        <%="1" %><br>
        <%="2" %><br>
        <%="3" %><br>
        <%="4" %><br>
        <%System.out.println("已经进入test1的JAVA纯代码部分"); %>
        <%System.out.println(1); %>
        <%System.out.println(2); %>
        <%Thread.sleep(2000); %>
        <%System.out.println(3); %>
        <%System.out.println(4); %>
        <%Thread.sleep(2000);%>
        <%System.out.println(5); %>
        <% long i=0;
           for(;i<999999999;i++); 
           System.out.println(i);%>
         <%=i %><br>
        <%--<%response.sendRedirect("test3.jsp"); %>--%>
        <%System.out.println(6); %>
        <%System.out.println(7); %>
        
                   
        <%="5" %><br>
        <%="6" %><br>
        <%="7" %><br>
        <input type="submit" value="test2-name" name="name">
        <input type="reset" value="test2-age" name="age">
        <input type="text" name="test2-address">
        
       </body>
    </html>
    结果是老在当前页面反复刷新
      

  4.   

    这样写行吗?jsp默认的缓存是8kb,你
     <% long i=0;
           for(;i<999999999;i++); 
           System.out.println(i);%>
     <%=i %><br>
    应该超出了,即使你设置了flush为true,默认为true.
    也就是说在你转页面的时候服务器一直给你发东西,转了服务器又发东西到了你这个页面
    所以你就一直感觉它在刷新,可以把i值改小.
    你可以察看页面源代码,应该没有这些东西:
    <input type="submit" value="test2-name" name="name">
        <input type="reset" value="test2-age" name="age">
        <input type="text" name="test2-address">
        
       </body>
    </html>
      

  5.   

    什么缓存啊?什么flush啊?讲明白点
    我刚学JSP,什么都不懂
      

  6.   

    还有我上面下的有没有语法错误啊?
    <meta   http-equiv="refresh"   conten=3;url=跳转页面的路径/> 
    例如有没有少一个空格 少了引号
    能巨个具体的例子吗?
      

  7.   

    <%response.setHeader("refresh","time;url");%>
      

  8.   

    晕还是不行啊
    我的代码那里出错了?<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
    <%
    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 'test2.jsp' starting page</title>
        
    <meta http-equiv="refresh" conten=3;url=http://localhost:8080/JSPtest1/test4.jsp/>
    <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>
        This is my test2 page. <br>
         <% String str=(String)session.getAttribute("lzw"); %>
        <%if (str==null){ %>The JSPtest1-test2 Page is null
        <%}else{ %>The JSPtest1-test2 Page is  <font color="#ff0000">not</font> null<%} %>
        <%response.setHeader("refresh","time;url");%>
        <input type="submit" value="test2-name" name="name">
        <input type="reset" value="test2-age" name="age">
        <input type="text" name="test2-address">
        
      </body>
    </html>
      

  9.   

    在 <head> 和 </head> 之间添加一个META标记,如下所示 
    <meta http-equiv="refresh" content="3;url=跳转页面的路径">
    把"跳转页面的路径"改成你要跳转的路径,可以是相对路径,也可以是绝对路径。 
    "conten=3"表示3秒钟后跳转。
      

  10.   

    <meta http-equiv="refresh" content="3;url=跳转页面的路径"> 
    要注意content="3;url=跳转页面的路径" 的双引号位置必须这样
      

  11.   

    thanks
    我还真的以为是什么缓存等等的关系导致跳转不了,原来是代码错误..
    想给你加分,但是提示不到5天不能加......AXuan_Good_GAME 
      
      

  12.   

    http://www.zihou.com/test
    这里面的例子做得更好些
      

  13.   

    这个问题吧,所说的是CSDN上的技术吧,整个是一个.html,页面啊,在底下部可以发贴子,但发完成,3秒就可以返回页面,并做到局部刷新的呢,.是局部,刷新,还是局部提交,好啊,值得学习一下子的呢.还生成了表态的文件...html.
    大家可以讨论一下,互相学习啊,呵.