Shiro(3) controller中获取当前登录用户信息
//Shiro controller中获取当前登录用户信息
方式一:
@RequestMapping(value = "/competitorPageList" )
public String competitorPageList(Model model, ) {
Long currentUserId = (Long) SecurityUtils.getSubject().getSession().getAttribute("currentUserId");
}
方式二:
@RequestMapping(value = "/competitorPageList" )
public String competitorPageList(Model model,HttpServletRequest request ) {
Long currentUserId = (Long) request.getSession().getAttribute("currentUserId");
}
声明:该文观点仅代表作者本人,牛骨文系教育信息发布平台,牛骨文仅提供信息存储空间服务。
- 上一篇: -eq和=的区别
- 下一篇: shiro中获取当前user出错
