File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Session handling in JSF

 
Jack pero
Greenhorn
Posts: 27
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please could anyone help me with how to do session handling in JSF.
It would be more helpful if you could just give a example or code snippet for both bean class and for JSF page
And how to user Security Filter for this session.

Thanks in advance..
vin
 
Tim Holloway
Saloon Keeper
Pie
Posts: 17616
39
Android Eclipse IDE Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"vin32001", we'd like to welcome you to the JavaRanch. We're not much on rules around here, but we like to keep things professional, so we have a policy for display names. You can find the details at http://www.javaranch.com/name.jsp . If you would be so kind as to change your display name to conform to those requirements, we'd really appreciate it.

In answer to your question, JSF supports session-scope backing beans. If you define one or more beans in session scope, a J2EE session will be created automatically and the bean will be stored in it the first time you reference that bean, and the session will remain until you either explicitly destroy it (by obtaining the HttpRequest session object and invoking session.invalidate() on it), OR the session times out.

Sessions are also useful for maintaining security context, but I don't use filters for this purpose. I prefer container-based security.
 
Jack pero
Greenhorn
Posts: 27
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for advice and solution provided. But the solution for session i got, now the main issue is with Security Filter. It should check if the session is valid or not, if not valid than create new and if valid it should check if the user is authorised.
This much i tried, but problem is, how do i put it in web.xml. Because i want to call it from there for all pages.

This is the way i tried, is it fine or..what changes needs to be done


thanks ..
vin
 
Y Jadhav
Ranch Hand
Posts: 37
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please could anyone help me with how to do session handling in JSF.
It would be more helpful if you could just give a example or code snippet for both bean class and for JSF page
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic