• Post Reply Bookmark Topic Watch Topic
  • New Topic

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

 
alex ni
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!