用sendRedirect跳转

用sendRedirect跳转:
马克- to-win:马克 java社区:防盗版实名手机尾号: 73203。
response的方法:void sendRedirect(String url),将页面重定向到指定的URL地址上。

例:3.3.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 {
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        response.sendRedirect("http://localhost:8080/ServletHello/cookie.html");
        System.out.println("ok");
    }
}