Legolas Woodland wrote:

A question about managed beans , how MB methods treated ?
Hi thank you for reading my post.
I have a managed bean like the following defined in faces-config.xml



   <managed-bean>
       <description>Over all report Bean</description>
       <managed-bean-name>OAllReport</managed-bean-name>
       <managed-bean-class>publisher.OAllReport</managed-bean-class>
       <managed-bean-scope>session</managed-bean-scope>
   </managed-bean>


publisher.OAllReport class has a method which in that method do some sql operations. I learned this from a tutorial and i tried to use it in my application , but before my decision goes final
i want to know that

As i said i have some methods that do sql operation , i did nothing in constructor. -does sql operations run without call to methods ? i mean does JSF engine call methods of a managed bean ?
-does it brings some loads to my system ?
-when System initiate those classes ?


When some other bean or page evaluates an expression like "#{OAllReport.something}", JSF looks for the name "OAllReport" in request, session and application scopes. If it doesn't find an entry, then it will create the object using the managed bean definition.

In other words, managed beans are created only when they are needed.

When it creates the object, it calls the setter for every managed-property declaration.

No other methods are called on the managed bean.

You might like to read the wiki FAQ entry titled:
 "How do I know when a managed bean's properties have all been set?"

I believe that the Shale project provides additional useful lifecycle-related methods for JSF pages and backing beans, though I don't know a lot about this.

Regards,

Simon

Reply via email to