import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@WebServlet("/s04")
/*
* 请求转发
* req.getRequestDispatcher("s03").forward(req,resp);
* 可以让请求从服务端跳转到客户端 或者跳转到servlet
* 服务端行为
* 1:地址栏不改变
* 2:服务端行为
* 3从始自终只有一个请求
* 4request数据可以共享
* */
public class servlet04 extends HttpServlet {
@Override
protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
//接受参数
String uname = req.getParameter("uname");
System.out.println("uname04" + uname);
//请求跳转到04
//req.getRequestDispatcher("s03").forward(req,resp);
//请求转发跳转到jsp页面
//req.getRequestDispatcher("login.jsp").forward(req,resp);
req.getRequestDispatcher("login.html").forward(req,resp);
}
}