Search
Categories

Entries in api (1)

Tuesday
10Nov2009

Working out the API for Xsp Classes in XPages

One of the biggest problems I have is interacting with the various components of an XPage programatically. It's not that I can't get hold of them, but it is that I don't know what classes they are from a Java point of view, and therefore don't know what methods and properties I have available to me.

So my solution is to first create an error. Say, for example, I want to programatically control a Pager control. I'll add a button to my XPage with an onClick event something like this:

getComponent("pager1").setStart(1);

I know this will fail, but if I have the default error page enabled then I'll get an error message like this:

And from the error message I can now tell that the object I want to talk to is of the class "com.ibm.xsp.component.xp.XspPager" and when I add that to the variable definition I'll get full type ahead of the API for that class in Domino Designer. So now I know that I can write something like this:

var pager:com.ibm.xsp.component.xp.XspPager = getComponent("pager1");
pager.gotoFirst();