Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

A Bit of Backing Bean Lifetime Confusion  RSS feed

 
Henry Lowell
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, say I have a backing bean and the scope is request. The form associated with said bean gets submitted. I know that a new instance of said bean is being created. So is it safe to assume or a true statement to say that the properties of said bean are persisted across the request but the bean object is not? And if so, why not? Why not just persist the backing bean across the request instead of just the properties?

Thanks.
 
Henrique Sousa
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is more a matter of naming, i think. You see, the request is nothing more than a bunch of parameters. I dare to call it a java.util.Map<String,String>. The framework maps parameters to properties, so you could state, from the framework user point of view, that the properties are persistent across requests.
Now, the properties must exist in some instance, so it is created if its scope is set to request. Why not persist it accross requests? Simply put, because Map<String,String> does not support Object. You can use a converter to create a String representation of your object and "persist" it acrross requests.
So this is just a matter of passing Strings, not objects. I hope this is clear enough to be understandable.
[ June 09, 2006: Message edited by: Henrique Sousa ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!