File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Keeping current logged user." Watch "Keeping current logged user." New topic

Keeping current logged user.

Stas Melnychenko

Joined: Feb 20, 2012
Posts: 14

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?

I agree. Here's the link:
subject: Keeping current logged user.
It's not a secret anymore!