Ryan, Jacob:
Thank you for the information, but I'm stuck with an logic issue.
Once I inject my EJB with:
@EJB private CustomerSessionLocal customerSessionRemote;
Do I assign "customerSessionRemote" to a managed property? Such as:
<managed-property>
<property-name>currentCustomer</property-name>
<property-class>com.dtn.bean.customer.CustomerSessionLocal</property-cla
ss>
<null-value/>
</managed-property>
So I can access a method in my "customerSessionRemote" EJB reference?
Bottom line is, I need:
1.) Inject or Lookup an EJB
2.) Each time the page is loaded, call a method - pass a parameter to
the method - in the EJB to return a List. The list is used to populate a
h:selectManyListbox.
I can't used a method with the @PostConstruct annotation since that is
only called once and I can't call that method again.
The 'pass a parameter to the method' to an EJB method each time the page
is loaded is really throwing me for a loop.
Once I have the EJB reference, I put the business logic in a void return
type method and made a reference to the method in the bean constructor,
but it throws a NullPointerException the first time the page is loaded
because the constructor runs before the EJB injection...
Any thoughts on this?
Thanks,
--Todd
-----Original Message-----
From: jacob_at_hookom.net [mailto:jacob_at_hookom.net]
Sent: Friday, May 18, 2007 1:25 PM
To: users_at_javaserverfaces.dev.java.net
Subject: Re: At which Managed Bean Lifecycle Phase does Injection
happen?
http://weblogs.java.net/blog/jhook/archive/2007/05/jsf_12_ri_backi.html
Todd Patrick wrote:
> JSF 1.2_04
>
> At which Managed Bean Lifecycle Phase does Injection happen or does
> Injection happen after all of the Lifecycle Phases have completed?
>
Injection isn't associated with a phase, it will occur when the bean is
first referenced and not already in scope.
> If I inject an EJB with:
>
> @EJB private CustomerSessionLocal customerSessionRemote;
>
> I can do set-up with a method annotated with @PostConstruct, however I
> cannot use any parameters.
>
> I'd like to call a EJB method AND pass parameters each time the
> managed bean is loaded for the JSF page being called.
>
> What is happening is the annotated method is called once - thus any
> call to the page again still has the first call values, I need to pass
> different parameters based on the user's selections on the JSF page.
>
> JSF --> [parameters] -->
> Managed Bean --> [parameters] -->
> Injected EJB --> [parameters] --> EJB method
>
> Is this scenario possible and how?
>
If you use managed-properties, these would be initialized before the
@PostConstruct callback was invoked and thus be available for use.
> Thanks,
>
> --Todd
>
> -----------------------------------------
> NOTICE: This email message is for the sole use of the intended
> recipient(s) and may contain confidential and privileged information.
> Any unauthorized use, disclosure or distribution is prohibited. If you
> are not the intended recipient, please contact the sender by reply
> email and destroy all copies of the original message.
>
> ---------------------------------------------------------------------
> 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