aspose file tools*
The moose likes JSF and the fly likes Session handling in JSF Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Session handling in JSF" Watch "Session handling in JSF" New topic
Author

Session handling in JSF

Jack pero
Greenhorn

Joined: Sep 09, 2005
Posts: 27
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

Joined: Jun 25, 2001
Posts: 16236
    
  21

"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.


Customer surveys are for companies who didn't pay proper attention to begin with.
Jack pero
Greenhorn

Joined: Sep 09, 2005
Posts: 27
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

Joined: Oct 02, 2008
Posts: 37
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Session handling in JSF