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");
       }

你可能感兴趣的:(java,web)