How to get session information in Spring MVC 3

后端 未结 2 1771
长发绾君心
长发绾君心 2021-02-04 01:52

I am new to spring MVC and I am trying to get the session information in my controller class

Right now I am using

HttpSession objHttpSession = re

2条回答
  •  旧巷少年郎
    2021-02-04 01:54

    I usually declare a parameter of type HttpSession in my Spring MVC controller method when I need to access session details.

    For example:

    @RequestMapping("/myrequest")
    public void handleMyRequest(HttpSession session, ...) {
       ...
    }
    

    I think it's the simplest way, but don't know if it fits your needs.

提交回复
热议问题