aspose file tools*
The moose likes JSF and the fly likes how to access faces context and backing beans in a servlet filter Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "how to access faces context and backing beans in a servlet filter" Watch "how to access faces context and backing beans in a servlet filter" New topic
Author

how to access faces context and backing beans in a servlet filter

Vincent Zhao
Greenhorn

Joined: Jul 09, 2008
Posts: 28
Is there a way to get hold of a managed bean with session scope in a servlet filter? The code below throws an error due to the fact that the faces context is null.

Vincent Zhao
Greenhorn

Joined: Jul 09, 2008
Posts: 28
This thread help me out:
http://wiki.apache.org/myfaces/AccessFacesContextFromServlet AccessFacesContextFromServlet

Vincent Zhao
Greenhorn

Joined: Jul 09, 2008
Posts: 28
This post help me a lot.
webpage
Vincent Zhao
Greenhorn

Joined: Jul 09, 2008
Posts: 28
Now, I can access backing beans in a servlet filter. But after I populate value to this backing bean, it didn't keep in session scope for future. How can I do next?
Vincent Zhao
Greenhorn

Joined: Jul 09, 2008
Posts: 28
Yes, there is a way to get hold of a managed bean with session scope in a servlet filter.
See here:
AccessFacesContextFromServlet

and here:
how to access faces context and backing beans in a servlet filter


After I get User bean in my Servlet filter, I populate value to this bean, for example:
user.setLanguage(request.getParameter("locale"));
The User bean is in session scope. The User bean's language attribute suppose to be same in the whole session scope, but later on, I got null. My question is:
how to keep this value in session scope?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to access faces context and backing beans in a servlet filter