Accessing the sessionScope map

Thursday, June 5, 2014 at 5:26 PM UTC

This is more a question than actually a post to show you something. But I think that this question is not suitable for Stackoverflow, so I decided to put it here.

Today I tried to read a session scope variable in my Java code. The code is being executed in the computed value of a computed text element on an XPage - and not used as a bean.

The XPage is loaded after several sessionScoped variables were set before in another page.

When I was trying to access the variable via

ExtLibUtil.getSessionScope().get("myKey")

it returned null and not the value I expected (in this case a long).

After searching for the cause I just tested the other way to gain access to the sessionScope map via

Map sessionscope = (Map) ExtLibUtil.resolveVariable(FacesContext.getCurrentInstance(), "sessionScope");

This one worked, returned the map and I could access the value via the get("myKey") method.

I am pretty sure that this works as designed and it is described somewhere (I admit that I still didn't find the time to read in the Mastering XPages ed.2 book yet Half ).

Can you give me a hint what was happening here? I always try to avoid the variable resolver due to performance/memory issues so I'd be interested what was going wrong here.

UPDATE

Yesterday I immediately received an answer:

https://twitter.com/Gidgerby/status/474615613789589504







Leave a comment right here