In SessionListener I want to set some values of @ManagedBean with Session scope that I want to show in JSF.
In SessionListener I want to set some values of @ManagedBean with Session scope that
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You’d need to create the managed bean instance yourself.
JSF will just reuse it if it already exist in the session scope (you see, the JSF “session scope” is under the covers represented by attributes of
HttpSession). Note that this way any@PostConstructwon’t be invoked and any dependencies which needs to be injected by@ManagedProperty,@EJB, etc, won’t be injected at all. You’d need to do it yourself as well.Designtechnically, much better is to perform the job just in the constructor or
@PostConstructmethod of the backing bean class itself.