JSP中页面定时刷新
1.JSP中页面定时刷新
- <%
- //页面每隔30秒自动刷新一遍
- response.setHeader("refresh" , "30" );
- %>
- <%
- //页面每隔30秒自动刷新一遍
- response.setHeader("refresh","30");
- %>
<% //页面每隔30秒自动刷新一遍 response.setHeader("refresh","30"); %>
2.JSP中页面定时刷新至另一个指定页面
- <%
- //页面每隔30秒自动链接至另一页面
- response.setHeader("refresh" , "30;URL=http://www.sina.com" );
- %>
- <%
- //页面每隔30秒自动链接至另一页面
- response.setHeader("refresh","30;URL=http://www.sina.com");
- %>
<% //页面每隔30秒自动链接至另一页面 response.setHeader("refresh","30;URL=http://www.sina.com"); %>
3.<meta http-equiv="refresh" content="30">
- <%@ page contentType= "text/html;charset=GBK" %>
- <%
- //页面每隔30秒自动刷新一遍
- response.setHeader("refresh" , "10;URL=http://www.sina.com" );
- %>
- <html>
- <head>
- <title>My JSP 'index.jsp' starting page</title>
- <!-- <meta http-equiv="pragma" content= "no-cache" >
- <meta http-equiv="cache-control" content= "no-cache" >
- <meta http-equiv="expires" content= "0" >
- <meta http-equiv="refresh" content= "30" > -->
- <script type="text/javascript" >
- alert("jsp" );
- </script>
- </head>
- <body>
- This is my JSP page. <br>
- </body>
- </html>