jQuery in Action, 3rd edition
The moose likes JSF and the fly likes JSF Bean is empty even though I initialized it in a servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "JSF Bean is empty even though I initialized it in a servlet" Watch "JSF Bean is empty even though I initialized it in a servlet" New topic
Author

JSF Bean is empty even though I initialized it in a servlet

alex ni
Greenhorn

Joined: Dec 03, 2012
Posts: 2
I have a bean with this header:


I have a loadInventory servlet that initialized the bean and redirects to a JSF


But the JSF shows the bean as empty:



So I'm thinking that "inventoryBean" in my servlet is not the same as the managed Bean also called "inventoryBean."
In that case how do I access the managed bean in the servlet?
alex ni
Greenhorn

Joined: Dec 03, 2012
Posts: 2
Well...I figured it out. The bean was request scoped instead of session scoped. Moderator, should I delete this question? Or leave it up?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17046
    
  26

alex ni wrote:Well...I figured it out. The bean was request scoped instead of session scoped. Moderator, should I delete this question? Or leave it up?


Leave it. People are running into this problem all the time. Request Scope has much less usefulness in JSF than it does in most web frameworks.


An IDE is no substitute for an Intelligent Developer.
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: JSF Bean is empty even though I initialized it in a servlet
 
It's not a secret anymore!