Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Vincent Zhao
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 28
 
Vincent Zhao
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This post help me a lot.
webpage
 
Vincent Zhao
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic