Search code examples
javaxpages

read sessionScope variable in Java?


In my xpages application I set some variables that are valid for the session of the user in a sessionScope variable.

I would like to use these user settings in my Java classes.

Is possible to read a specific sessionScope variable in my java class and how should I do this?


Solution

  • Have a look at the com.ibm.xsp.extlib.util.ExtLibUtil class. It comes with static methods to access the scope variables. You can get a map of all session scope variables like this:

    Map sessionScope = ExtLibUtil.getSessionScope();
    String yourVar = (String) sessionScope.get("varName");