首页 > 代码库 > request实现页面包含

request实现页面包含

 1 package cn.itcast.request; 2  3 import java.io.IOException; 4  5 import javax.servlet.ServletException; 6 import javax.servlet.http.HttpServlet; 7 import javax.servlet.http.HttpServletRequest; 8 import javax.servlet.http.HttpServletResponse; 9 10 11 import cn.itcast.User;12 13 //用include实现页面包含14 public class RequestDemo extends HttpServlet {15 16     public void doGet(HttpServletRequest request, HttpServletResponse response)17             throws ServletException, IOException {18 19         request.getRequestDispatcher("/MyJsp.jsp").include(request, response);20         response.getWriter().write("heihei!");21     }22 23     public void doPost(HttpServletRequest request, HttpServletResponse response)24             throws ServletException, IOException {25 26     }27 28 }
View Code