Spring: An object stored and used in the Sitemesh decorator

This is probably a newbie question.

I have a USER table that contains information about login, transfer and permissions. Depending on the authority or role, detailed information about each user can be found in one of the following: Teacher, Student, Parent. When a user logs in, the information stored in the USER table can be easily retrieved from the security context.

I want to show the first and last name all the time in the header after logging in - they can be extracted from other tables.

My question is this: how do I handle the storage of one of these objects in a session all the time? Or is everything all right, just to save the User (it was saved by spring), and then get a specific table every time I need detailed information?

I am using spring security 3, hibernate, jsp, sitemash.

To be sure:

I know how to work with a registered user and restrict some content. Login details (id, pass, role) are stored in the USER table, and this is normal - I can get it and show what I want. The problem is that the details about a specific user (address, name, email address, etc.) are stored in another table (STUDENT, TEACHER, PARENT - depending on the role in the USER table). This is what I want to know on every page - for example, to show my name.

+3
1

- 1. spring , . 2. UserDetailsService . 3. : authentication.getPrincipal() - rememebr .

- AbstracController, . , , , .

+1

All Articles