码迷,mamicode.com
首页 > 编程语言 > 详细

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

时间:2019-05-13 00:51:51      阅读:223      评论:0      收藏:0      [点我收藏+]

标签:ssi   nbsp   charset   session   cep   setattr   intern   tst   ade   

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

标签:ssi   nbsp   charset   session   cep   setattr   intern   tst   ade   

原文地址:https://www.cnblogs.com/ChangeMyWorld/p/10854366.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!