Get Spring Security Principal in JSP EL expression

后端 未结 11 2034
终归单人心
终归单人心 2020-12-13 04:07

I am using Spring MVC and Spring Security version 3.0.6.RELEASE. What is the easiest way to get the user name in my JSP? Or even just whether or not the user is logged in? I

11条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-13 04:47

    This works whether user is logged in or not, and works when using Anonymous Authentication:

    
        
    
    
        
    
    

    Later...

    Hello ${username}
    

提交回复
热议问题