tomcat session cookie 值设置,tomcat jsessionid设置
##调用request.getSession()
@Controller
@RequestMapping("/cookie")
public class CookieController {
@RequestMapping("/tomcatRequest")
@ResponseBody
public String tomcatRequest(HttpServletRequest request) {
String yym = request.getParameter("yym");
request.getSession().setAttribute("key", yym);
return yym;
}
}
##源码


##请求中没有获取到jsessionid,新建值

##设置到response header

##reponse header写回客户端


本文介绍了如何在SpringMVC的@Controller中通过HttpServletRequest设置Tomcatsession的cookie值(yym),并在响应头中处理jsessionid,以确保会话管理的正确性。

1976

被折叠的 条评论
为什么被折叠?



