You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Legolas Woodland <le...@gmail.com> on 2006/01/08 22:14:45 UTC
A question about managed beans , how MB methods treated ?
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 ?
Thank you
Re: A question about managed beans , how MB methods treated ?
Posted by Alexandre Poitras <al...@gmail.com>.
Craig McClanahan has said a couple of times that Shale can be seen as a
testing ground for new features in JSF 2.0 (If I remember correctly). Since
he was the JSF 1.0 cospecification leader, he's probably going to be on the
JCR expert group. So you might see some hints there that some Shale features
may end up in the JSF spec in the future :)
On 1/9/06, Mikael Andersson <ma...@gmail.com> wrote:
>
> Hi,
> I have a question regarding the managed bean lifecyle.
> I have read in some blogs about EJB3 like annotations which can be used
> with managed beans to hook into different stages of the lifecycle, but
> that's about all I know about it. My question is, is this a feature for JSF
> 1.2 specification? Would be nice to get this without using Shale :)
>
> Thanks,
> Mikael
>
> On 08/01/06, Simon Kitching <sk...@obsidium.com> wrote:
> >
> > 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
> >
>
>
--
Alexandre Poitras
Québec, Canada
Re: A question about managed beans , how MB methods treated ?
Posted by Mikael Andersson <ma...@gmail.com>.
Hi,
I have a question regarding the managed bean lifecyle.
I have read in some blogs about EJB3 like annotations which can be used with
managed beans to hook into different stages of the lifecycle, but that's
about all I know about it. My question is, is this a feature for JSF
1.2specification? Would be nice to get this without using Shale :)
Thanks,
Mikael
On 08/01/06, Simon Kitching <sk...@obsidium.com> wrote:
>
> 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
>
Re: A question about managed beans , how MB methods treated ?
Posted by Simon Kitching <sk...@obsidium.com>.
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