I know that we can access the XPages global objects like this in Java
FacesContext facesContext = FacesContext.getCurrentInstance();
ExternalContext externalContext = facesContext.getExternalContext();
...
...
But I am unable to find any equivalent for using getComponent()
is Java. Is there any class or method in Java which is similar to getComponent()
in SSJS?
In the Group extension of the Extension Library there is a query package that contains the XspQuery class and some filters. This class was intended to function like dojo.query to give you many different ways to find a component, not just by the id but also things like Component Class, Client ID, Server ID, etc. Here's an example of using the server ID to locate a component:
You can find it here: https://svn-166.openntf.org/svn/xpages/extlib/eclipse/plugins/com.ibm.xsp.extlib.group/src/com/ibm/xsp/extlib/query/
The Group extension was never distributed with the extension library, but was in the svn repository and to get it you had to go through the OpenNTF svn server.
It might be easiest by evaluating SSJS in Java. Code from Sven:
How to call ad hoc SSJS from a Java Bean
Here is pure Java solution by Karsten Lehmann:
http://www.mindoo.com/web/blog.nsf/dx/18.07.2009191738KLENAL.htm