I'm new to Java so sorry if my terminology is not correct.
I have a managed bean setup (PolicyInformation) with a session scope that I instantiate in my Java code with:
thisPolicy = (PolicyInformation) Utils.getSessionMapValue("policyInformationBean");
if (thisPolicy == null) {
thisPolicy = new PolicyInformation();
}
The code above checks if the bean already exists, and if it does, it uses the object in the session map. It seems to work great.
However, if I add a label on my XPage to display a value from my PolicyInformation managed bean with the following code (using expression language):
<xp:label value="#{policyInformationBean.name}"/>
the managed bean runs twice: once when I call it in my Java class, and again when I add the label above.
Is there a way I can prevent that second call when adding the label on my XPage? Can I somehow get the value from the Java session map in my XPage label?
faces-config:
<managed-bean>
<managed-bean-name>policyInformationBean</managed-bean-name>
<managed-bean-scope>session</managed-bean-scope>
<managed-bean-class>com.package.PolicyInformation</managed-bean-class>
</managed-bean>