wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Keeping current logged user. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Keeping current logged user." Watch "Keeping current logged user." New topic
Author

Keeping current logged user.

Stas Melnychenko
Greenhorn

Joined: Feb 20, 2012
Posts: 14

Hello.
I write my first web application, and I use JSF, Spring, Hibernate.
At first, I wrote authorization/registration part.
I have two pages, mainpage.jsp contain login form, and registration.jsp contain registering form.
And this is my beans:


So, my backbeans UserLogin and UserInfo are request-scoped, because its contain error messages like "Password is incorrect" or "User UserName already exists". And now I need one more session-scoped bean for containing current logged user. But I an not sure, HOW, so tell me please, am I wright:
I want to add new bean UserInfo and change existing bean UserLogin:



and method of UserLogin:



I change to



and UserInfo will contain



Am I on wright way or this is bad shot?

Another method: leave all beans in current stand, and just get current http session in login procedure and save user in it.

So what way is better?

 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Keeping current logged user.
 
Similar Threads
spring+hibernate: insert data into database(one to many)
Error: Bean property 'userDAO' is not writable or has an invalid setter method.
session scope
Spring DAO + Hibernate; is this right?
Hibernate error with Spring MVC