一、请求转发
- OneServlet
package com.lpx.controller;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.IOException;
public class OneServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("OneServlet 负责洗菜");
RequestDispatcher report = request.getRequestDispatcher("one.do");//请求转发时不能从网站根目录名称开始写
report.forward(request,response);
}
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
}
}
- TwoServlet
package com.lpx.controller;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.IOException;
public class TwoServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest request, H