牛骨文教育服务平台(让学习变的简单)
博文笔记

Shiro(3) controller中获取当前登录用户信息

创建时间:2017-07-17 投稿人: 浏览次数:12586

//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");
       }
声明:该文观点仅代表作者本人,牛骨文系教育信息发布平台,牛骨文仅提供信息存储空间服务。