6、SpringMVC之使用原生API

/**
 * 获取原生API HttpServletRequest,HttpServletResponse HttpSession等
 * 
 */
@RequestMapping("/selectUser")
public String selectUser3(HttpServletRequest request, HttpServletResponse response){
    String name = request.getParameter("name");

    HttpSession session = request.getSession();
    session.setAttribute("Account", new Account());
    System.out.println(session);

    ServletContext servletContext = session.getServletContext();
    System.out.println(servletContext);

    return "success";
}
posted @ 2020-07-31 17:14  lawrence林  阅读(163)  评论(0编辑  收藏  举报