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.
"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.
An IDE is no substitute for an Intelligent Developer.
Joined: Sep 09, 2005
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