• Post Reply Bookmark Topic Watch Topic
  • New Topic

How Keep a Session Data In JSF

 
Malinda Alahakoon
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can i keep data Needed to a Specific Session..
In JSF..
Like Session Attributes..
 
Malinda Alahakoon
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Some one Please Tell me what is the Best way..
 
Ketan Jambhekar
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
To set the attributes in session you can fetch the session from the FacesContext using the following ..


and then set the required object in session.
You can also set the scope of your managed bean as session and use.

Ketan.
 
Manuel DeAngelo
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would prefer your second solution, I think it is much more straightforward.

Just create one Bean thats session scope with all attributes you want, then you are able to store them directly and type safe, whereas when storing directly in session you have no type safety at compiling time, because you could throw everything in.

regards, Manuel
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!