如何用setHeader("refresh"...实现跳转?

Posted mark-to-win

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了如何用setHeader("refresh"...实现跳转?相关的知识,希望对你有一定的参考价值。

2.用setHeader("refresh"...跳转:(视频下载) (全部书籍)


马 克-to-win:使用response对象的setHeader()方法可以实现在某个时间点跳转到某个页面的作用。比如 response.setHeader("refresh",60);可以实现六十秒以后,又一次访问当前页面。而response.setHeader ("refresh","3;URL=http://localhost:8080/ServletHello/cookie.html"); 实现3秒后访问新页面:http://localhost:8080/ServletHello/cookie.html。



例:3.2.1


package com;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class DeleteCookie extends HttpServlet {

详情请见:http://www.mark-to-win.com/index.html?content=Jsp/jspUrl.html&chapter=Jsp/jsp2_web.html#setHeaderrefresh
















以上是关于如何用setHeader("refresh"...实现跳转?的主要内容,如果未能解决你的问题,请参考以下文章