首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

java WEB Response重定向缓和存控制

2013-09-13 
java WEB Response重定向和缓存控制package cn.comimport java.io.IOExceptionimport javax.servlet.Ser

java WEB Response重定向和缓存控制

package cn.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 ResponseChongdingxiang extends HttpServlet {private static final long serialVersionUID = 1L;   protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {response.sendRedirect("/Response/MyHtml.html");/*  response.setStatus(302); response.setHeader("location", "url=/Response/MyHtml.html");*/}protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {doGet(request,response);}}package cn.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 ResponseHuancun extends HttpServlet {private static final long serialVersionUID = 1L;  protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {String str="aaaaaaa";response.setDateHeader("expries", System.currentTimeMillis()+1000*3600);response.getWriter().write(str);}protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {doGet(request,response);}}

热点排行