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);

 

}


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM