Spring MVC: HTTP session management “equivalent”

て烟熏妆下的殇ゞ 提交于 2019-12-02 06:15:18

You may use a session-scoped bean, and you may also have an argument of type HttpServletRequest or HttpSession on all your request handling methods. See http://static.springsource.org/spring/docs/3.1.x/spring-framework-reference/htmlsingle/spring-framework-reference.html#mvc-ann-methods.

@RequestMapping...)
public String processSubmit(..., HttpSession session, ...) {
    ...
    session.setAttribute("someAttribute", someObject);
    ...
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!