« Back to home

XPages JavaScript mystery meat

When using XPages, I try to build as much as possible in Java, and then use as little JavaScript as possible to glue the Java code into XPages.

The main problem I hit when doing this is ensuring that my Java methods have the right type signatures to get found and called by JavaScript. It’s confusing to call someMethod(true) and find that you get a run-time error saying there’s no Java method someMethod(boolean), even though there is.

So I put together a quick Java class to dump back the types of the objects it was passed, and then fed it everything I could think of from an XPage. Here’s the result.

Function arguments

ParameterReceived as
booleanjava.lang.Boolean
numberjava.lang.Double
nullnull
stringjava.lang.String
arrayjava.util.Vector
hashcom.ibm.jscript.std.ObjectObject

Predefined variables

ParameterReceived as
applicationScopecom.sun.faces.context.ApplicationMap
cookiecom.sun.faces.context.RequestCookieMap
facesContextcom.ibm.xsp.domino.context.DominoFacesContext
headercom.sun.faces.context.RequestHeaderMap
headerValuescom.sun.faces.context.RequestHeaderValuesMap
initParamcom.sun.faces.context.InitParameterMap
paramcom.sun.faces.context.RequestParameterMap
paramValuescom.sun.faces.context.RequestParameterValuesMap
requestScopecom.sun.faces.context.RequestMap
sessionScopecom.sun.faces.context.SessionMap
viewcom.ibm.xsp.component.UIViewRootEx2
document data sourcecom.ibm.xsp.model.domino.wrapped.DominoDocument
view data sourcelotus.domino.local.View
extlib object data sourceThe Java class of your object data source
predefined variable ‘database’com.ibm.domino.xsp.module.nsf.NSFComponentModule.XPagesDatabase
predefined variable ‘session’lotus.domino.local.Session
text field control via getComponentcom.ibm.xsp.component.xp.XspOutputText or other appropriate class from that package

Note that many of the JSF and XPages variables are accessible directly from Java, so you generally shouldn’t need to pass them as parameters — but I’ll leave that decision to you.