使用途径:在Controller中的handler方法的参数列表中绑定引用即可
例如:
@RequestMapping("/servletApi")
public ModelAndView empTest(HttpServletRequest req, HttpServletResponse resp, HttpSession ss, ServletContext context){
String name = req.getParameter("name");
HttpSession session = req.getSession();
ServletContext servletContext = req.getServletContext();
req.setAttribute("name",name);
req.getRequestDispatcher("/jsp/index.jsp");
return null;
}
用法和在Servlet类中一致