servlet使用sessio和spring mvc中的controller使用session

Posted changemyworld

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了servlet使用sessio和spring mvc中的controller使用session相关的知识,希望对你有一定的参考价值。

protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

 

request.setCharacterEncoding("UTF-8");
response.setHeader("Content-type","text/html;charset=UTF-8");

HttpSession session = request.getSession(true);

session.setAttribute("rno",list.get(0));

}

 

 

protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {

request.setCharacterEncoding("UTF-8");
response.setHeader("Content-type","text/html;charset=UTF-8");

HttpSession session = request.getSession(true);

String name = student.getSTUNAME();

session.setAttribute("name",name);

 

}

以上是关于servlet使用sessio和spring mvc中的controller使用session的主要内容,如果未能解决你的问题,请参考以下文章