使用response实现定时刷新
2017-12-13 14:23
246 查看
定时刷新的原理:设置HTTP响应头Refresh:1;url=http://localhost:8080/demo/index.jsp
方法一、使用response.setHeader();方法
[java] view
plain copy
response.getWriter().write(new Date().toLocaleString());
response.setHeader("Refresh", "1");
方法二、使用HTML的<meta>元素
[html] view
plain copy
<meta http-equiv="refresh" content="3;url=/demo/index.jsp">
实例:三秒后回到主页的实现方法
在Servlet中,重定向到ok.html,ok.html的内容如下
[html] view
plain copy
<html>
<head>
<meta http-equiv="refresh" content="3;url=/demo/index.jsp">
</head>
<body>
恭喜,3秒后回到主页...
</body>
</html>
方法一、使用response.setHeader();方法
[java] view
plain copy
response.getWriter().write(new Date().toLocaleString());
response.setHeader("Refresh", "1");
方法二、使用HTML的<meta>元素
[html] view
plain copy
<meta http-equiv="refresh" content="3;url=/demo/index.jsp">
实例:三秒后回到主页的实现方法
在Servlet中,重定向到ok.html,ok.html的内容如下
[html] view
plain copy
<html>
<head>
<meta http-equiv="refresh" content="3;url=/demo/index.jsp">
</head>
<body>
恭喜,3秒后回到主页...
</body>
</html>
相关文章推荐
- javaweb(三):使用response实现定时刷新
- Ajax4jsf使用a4j:poll实现定时刷新
- 使用meta实现页面的定时刷新或跳转
- servlet相关知识,使用servlet实现定时刷新,实现页面登录次数统计
- 使用CSS中的meta实现web定时刷新或跳转的方法
- Servlet实现定时刷新到另外一个页面response.setHeader("refresh", "3;url=/...")
- 使用JQUERY实现局部页面定时刷新
- 菜鸟学Android笔记(二十八):response实现定时刷新
- Response_输出数据,实现文件下载,定时刷新页面,是否缓存,重定向,实现验证码
- response实现案例之页面定时刷新
- 页面定时刷新功能实现
- 使用MagicAjax 实现无刷新Webparts
- 使用ICallbackEventHandler接口实现页面无刷新
- 【原创】Asp中使用Ajax实现无刷新调用页面。
- 六步使用ICallbackEventHandler实现无刷新回调
- 六步使用ICallbackEventHandler实现无刷新回调
- [ASP.NET 2.0] 六步使用ICallbackEventHandler实现无刷新回调 (转)
- 使用无刷新技术,去请求该失效Session的页面,实现跳转到重新登陆页面。
- asp.net2.0中使用客户端回调实现无刷新应用!
- 六步使用ICallbackEventHandler实现无刷新回调