设置http响应头Location(控制浏览器显示哪个页面)

package cn.itcast.web.http;
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 Demo1 extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {
response.setStatus(302);
response.setHeader("location","/day05/114.html");
}
}

你可能感兴趣的:(http相关知识)