Project development uses HttpSession to store the current logged-in user (1) User information, (2) can be governed by the company

Source: Internet
Author: User

question:

When a user logs on to the system, assigns a session object to the currently logged-on user. Used to store this user-related

(1) User information: User ID, user name, user password, user location, etc.;

(2) Users can be governed by the Company (User data Rights Management: The current logged-on user can only view the driver information under their own company): Multiple company ID,

separated by commas.

After you use session, you can read the data for related operations in other JSP pages or in the controller class of the project.


Implementation method:

1. When the user login successfully, will (1) user information, (2) can be governed by the company information in the session

(1) Store user information in session


(2) storing the information of the competent company in the session


2. Read the user information in the session in the project's controller class

   


Use the GetSession method in Basesession.java to get the session of the currently logged-on User:



3. Read the session's governing company information in the project's JSP page



Expand your reading: 1. A great introduction to the session of the aloof Wolf: http://www.cnblogs.com/xdp-gacl/p/3855702.html


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.