i am new to jsf so if this seems like a very basic question i do apologize.
when is the beacking bean of a jsp instantiated. i mean when are the values set using the setter methods. is it at the time of page loading , page submitting???
and this function gets executed on a button click(the button does only this, page is not submitted or anything), will the corresponding setSomeField() method be executed immediately??
If you refer to a JSF View that references a previously-undefined backing bean, the framework will instantiate the bean as part of the process of preparing the view display. If it has managed properties, their setters will be called at that time. If any of the managed properties are themselved un-instantiated backing beans, those beans are first constructed and their managed properties (if any) are set.
However, thereafter the setter and getter methods may be invoked many times on a View Request/submit cycle. Which is why you should not attach complex logic or actions that have side-effects to the get/set methods.
An IDE is no substitute for an Intelligent Developer.
Joined: Sep 23, 2009
"the framework will instantiate the bean as part of the process of preparing the view display"
Stanley Walker wrote:"the framework will instantiate the bean as part of the process of preparing the view display"
That's one reason I avoid calling JSF Views "pages". Too much confusion from non-JSF/non-MVC usage.
JSF doesn't "load a page". It takes a view definition (usually from a file, often in JSP form) and compiles it into a tree structure. This structure serves as the basis for invoking the backing bean functions. When an action is invoked, a different View definition may be requested, in which case the old tree is discarded, and a new tree is compiled using the indicated new view definition.
JSF works with discrete rendering engines that take the view tree and the JEE environment (including JSF backing beans) and runs the selected renderer against that tree. The rendering process may and often will involve calling backing bean getters. Most commonly, the renderer used is the stock HTML renderer, but other renderers are also possible, including user-defined ones.
I really recommend you find some good documentation on the JSF lifecycle, and a book or 2 on JSF wouldn't be a bad investment.
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