users@javaserverfaces.java.net

RE: Re: Initialise Backing Bean from database

From: <jacob_at_hookom.net>
Date: Thu, 26 Apr 2007 17:15:14 -0400

Is it silent though on managed properties?


Actually, section 5.4.1 says this:

Methods on managed beans declared to be in request, session, or
application
scope, annotated with @PostConstruct, must be called by the JSF
implementation after
resource injection is performed (if any) but before the bean is placed
into scope.

So if the RI is processing @PostConstruct before injection, I think that
certainly needs to be changed.

-----
Jason Lee, SCJP
Senior Software Engineer
http://www.iec-okc.com
 

> -----Original Message-----
> From: jacob_at_hookom.net [mailto:jacob_at_hookom.net]
> Sent: Thursday, April 26, 2007 3:43 PM
> To: users_at_javaserverfaces.dev.java.net
> Subject: Re: Initialise Backing Bean from database
>
> ****
> Just to follow up-- Seam does @PostConstruct after injection.
> Since it's acting as a basis for WebBeans/Java EE-- I think
> it'd be appropriate to match this order now within the RI
> since the 1.2 spec is currently silent.
> ****
>
>
> You could specify a managed-property that will inject the
> string user--
>
> #{facesContext.externalContext.remoteUser}
>
> The problem with @PostConstruct is that it happens before
> property injection.
> So you could put that code, accessing the FacesContext
> directly into your backingbean.
>
> To Roger/Ed/Ryan-- I guess the spec is silent on when the
> @PostConstruct happens exactly. Would it be better to have
> this happen post injection, otherwise the @PostConstruct
> gains nothing over putting logic in the default constructor.
> At least post property injection, the @PostConstruct method
> would be able to use/process on injected logic.
>
> It'd be nice to inject a user or a request parameter, then
> basically have the @PostConstruct work like an Action's
> execute method, but done within the ManagedBean facility.
>
> I'll double check with Gavin/Seam to see when they invoke
> these methods within the injection process.
>
> -- Jacob
>
>
>
> Roger wrote:
> ===============================
> Hi Chris -
>
> Also, take into account Ryan's follow email about the
> annotations if you're using jsf 1.2.
>
> Thanks, Roger.
>
> ChrisC_at_Dive100.Freeserve.co.uk wrote:
>
> >It works - thanks - must have misread something
> >
> >
> >
> >
> >>Why do you say backing beans (managed beans) do not have a
> constructor?
> >>They are just POJO's, and you should be able to do the
> initialization.
> >>
> >>
> >>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_javaserverfaces.dev.java.net
> For additional commands, e-mail:
> users-help_at_javaserverfaces.dev.java.net
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_javaserverfaces.dev.java.net
> For additional commands, e-mail:
> users-help_at_javaserverfaces.dev.java.net
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_javaserverfaces.dev.java.net
> For additional commands, e-mail:
> users-help_at_javaserverfaces.dev.java.net
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_javaserverfaces.dev.java.net
For additional commands, e-mail: users-help_at_javaserverfaces.dev.java.net