Question

With Lotus Domino 8.5.1, one can use "standard" Java classes into server side Javascript (embedded into an Xpage), or Java classes available in the WEB-INF/lib folder. For example :

var driverClass:java.lang.Class;
var driver:java.sql.Driver;
var connection:java.sql.Connection;
var statement:java.sql.Statement;
driverClass = java.lang.Thread.currentThread().getContextClassLoader().loadClass("org.gjt.mm.mysql.Driver");
driver = driverClass.newInstance();

(sample found here here)

However, how could one use our own custom classes defined in Java script libraries ? In an Xpage, one can only import server side javascript libraries (not Java nor LS ones).

Thanks for your help

Cheers

Was it helpful?

Solution

Answer found on the wiki :

http://www-10.lotus.com/ldd/ddwiki.nsf/dx/reuse_java_xpage.htm

From an XPage it is easy to call Service Side JavaScript for business logic. The JavaScript has built in features that enable it to call Java. Unfortunately Server Side JavaScript, as used by XPages, cannot currently call Java routines created in a Java library. However it can call into a Java library that has been exported as a JAR file. As it turns out you can also create a Java library that also calls into a Java JAR file.

OTHER TIPS

We implemented nearly all logic using standard Java using Eclipse and Maven for developing Java and packaging them as JARs. We even configured Maven to copy the JARs to the appropriate directory on the domino server (/xsp/shared/lib is standard, or use /jvm/lib/ext to make classes available everywhere in domino, e.g. to implement own Java Server Addins ) automatically. I do recommend this approach.

Actually we used domino "just" as the app server and store data in an RDBMS.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top