Handling user session in jsf 2

1.5k views Asked by At

I'm building a web application using jsf2. I use a @ManagedBean with a @SessionScope. In it I store the username etc in a User object. Let's say I want to create an article, for that I have another @ManagedBean @RequestScope that has a createArticle() method, but it needs to set the article author. Should I inject the user session bean through cdi to get the user user object, is it ok to inject managedbeans into other managed beans? May be is there any other approach to would be better?

1

There are 1 answers

0
Damo On BEST ANSWER

The whole point of Dependency Injection is to inject managed beans into other managed beans. So yes, your approach is the way to go.