Home  >  Q&A  >  body text

java - SpringMVC+Shiro implements jump problem after login

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?

为情所困为情所困2672 days ago873

reply all(3)I'll reply

  • 世界只因有你

    世界只因有你2017-05-27 17:42:03

    Either request the user information to be displayed on the page after the jump, or bring the user information when the jump occurs.
    Also on the jsp page, shiro can use tags to directly obtain the user name, etc. You can take a look at this http://jinnianshilongnian.ite...

    reply
    0
  • 迷茫

    迷茫2017-05-27 17:42:03

    1. After successful login, save it to the session, and then read the page
    2. After successful login, return the login information, and then the page will display
    3. Shiro tag reads the user login information and displays it
    4. JSP custom tag, write and read in the background Get the logic and return to the front-end display
    5. After successful login, save it to cookie, and the front-end reads the cookie and displays it

    reply
    0
  • PHP中文网

    PHP中文网2017-05-27 17:42:03

    You can put the information in during authentication, and then after logging in, jump to this page and get it directly.
    -Supplement
    In the controller, put it in the model and get it on the page

    reply
    0
  • Cancelreply