The project uses SSM Shiro. If the login is successful, it will jump to the home page. It needs to know that the user has successfully logged in and display the user's information on the home page. How to do this.
The homepage is: index.jsp under Webcontent
SpringMVC configuration<url-pattern>/</url-pattern>
For example:
I visit https:/ /segmentfault.com, https://segmentfault.com is returned after successful login, but the user's information is loaded on the homepage.
I want to make the effect of changes before and after logging in to this site.
It seems that you can obtain the Subject in JSP and Java code to achieve this effect. Is there any better solution than this?
要么在跳转以后去请求用户信息显示在页面上,或者跳转的时候就把用户信息带过去。
还有在jsp页面上,shiro可以用标签直接获得用户名称的等等的功能的,你可以看一下这个http://jinnianshilongnian.ite...
1、登录成功后保存到session,然后页面读取
2、登录成功后返回登录信息,然后页面显示
3、shiro标签读取用户登录信息显示
4、jsp自定义标签,自己后台写读取逻辑,返回到前端显示
5、登录成功后保存到cookie,前端读取cookie显示
你可以在认证的时候把信息放进去,然后登陆后,跳转到该页面,就直接获取就好了。
-补充
在controller中,放到model里面去,在页面上获取