import java.io.IOException;
import java.text.DateFormat;
import java.util.Date;
import javax.servlet.*;
import javax.servlet.http.*;
public class RefreshServelet extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
//refresh头实现定时刷新到某个页面.
//一般可用作定时刷新,
//应用:股票,聊天室,
response.setHeader("Refresh", "0");
response.setContentType("text/html;charset=utf-8");
response.getWriter().print("每秒刷新一次:"+ new Date(System.currentTimeMillis()).toLocaleString());
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
}
}
refresh头实现定时刷新到某个页面.
最新推荐文章于 2023-05-01 09:17:37 发布