I want to store user information after logging in and to display my login and username on every page (using jsp). How can I get access in my jsp views to the session bean that would store information of the user that is logged in?
相关问题
- java.lang.IllegalArgumentException: Cannot set to
- “Zero out” sensitive String data in Swift
- Spring Data MongoDB - lazy access to some fields
- Declaring an explict object dependency in Spring
- How to dynamically load partial view Via jquery aj
相关文章
- java JDK动态代理和cglib动态代理最后获取的代理对象都为null的问题
- jsp里面的画布功能,为什么会出错?求大佬找下问题
- org.xml.sax.SAXParseException; lineNumber: 7; colu
- SpringMVC如何把File封装到Map中?
- JSP String formatting Truncate
- Warning : HTML 1300 Navigation occured?
- Spring: controller inheritance using @Controller a
- How to load @Configuration classes from separate J
I'm assuming you are using spring security. After successful login put the UserDetails object in the session like so (This is usually the controller where you would forward if login was successfull)
In your JSP you can access the UserDetails object, like so:
This is a near duplicate to When using Spring Security, what is the proper way to obtain current username (i.e. SecurityContext) information in a bean?. The Spring endorsed method is
but the linked discussion has alternatives.
use the authentication tag