Amy Knox commented on Jan 12, 2010

Accessing global XPage Javascript variables from Java code

While the above sample allows you to get to the Notes/Domino session, it is also possible to get handle to the JSF sessionScope(). From Java, you can get the same Map as explained in the article ( http://www-10.lotus.com/ldd/ddwiki.nsf/dx/23.06.2009094417WEBJ58.htm ), and then use the get() or the put() methods to respectively get or set the value:

public static Map getCurrentSessionScope() {

FacesContext context = FacesContext.getCurrentInstance();

return (Map) context.getApplication().getVariableResolver().resolveVariable(context, "sessionScope");

}

or you can use the JSF APIs like so:

FacesContext context = FacesContext.getCurrentInstance();

Map sessionScope = context.getExternalContext().getSessionMap();

The JSF apis are available at this link, but are subject to the Sun license agreements, which should carefully be reviewed before using the APIs (e.g. there are restrictions on implementing JSF): http://java.sun.com/javaee/javaserverfaces/1.1/docs/api/index.html

From a Java standpoint, the JSF sessionScope Map is just a wrapper to the HttpSession attribute collection, as specified by the JSF spec.

I hope this info is helpful.