I have a bean session
<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 insert this bean into the request:
<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 access vdcAddBean in providerSelectionBeanjava code, I get NPE because it vdcAddBeanis not yet initialized. If I go first in my menu, on the page with vdcAddBeanin the background, and return to providerSelectionBean, everything works fine, because it seems to be vdcAddBeanalready initialized.
The question is: how can I get vdcAddBean to initialize (if it is zero) when accessing the providerSelectionBeanbean?
Thank.
source
share