I have a session bean
<managed-bean>
<managed-bean-name>vdcAddBean</managed-bean-name>
<managed-bean-class>com.cloud.appsportfolio.jsf.vdc.beans.VDCAddBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
Now, I am injecting this bean into a request one:
<managed-bean>
<managed-bean-name>providerSelectionBean</managed-bean-name>
<managed-bean-class>com.cloud.appsportfolio.jsf.sourcing.ProviderSelectionBean</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
<managed-property>
<property-name>vdcAddBean</property-name>
<property-class>com.cloud.appsportfolio.jsf.vdc.beans.VDCAddBean</property-class>
<value>#{sessionScope.vdcAddBean}</value>
</managed-property>
</managed-bean>
Well, when I'm accessing vdcAddBean in providerSelectionBean
java code, I receive a NPE because vdcAddBean
is not yet initialized. If I'm going first in my menu, in a page which has vdcAddBean
in the back-end and comes back to providerSelectionBean
all works great because it seems that vdcAddBean
was already initialized.
The question is: how I can force vdcAddBean to be initialized (if it's null) when accessing providerSelectionBean
bean?
Thanks.