wood burning stoves*
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 Android Security Essentials Live Lessons this week in the Android 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: 15962
    
  19

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.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
Don't get me started about those stupid light bulbs.
 
subject: JSF Bean is empty even though I initialized it in a servlet
 
Similar Threads
h:datatable, how multiply row cell A with row cell B and set value in row cell C
Why not refresh jsf page
datatable - row colors
Creating List/Array of Managed Beans
boolean property in dataTable