Since I get asked this regularly here is a quick overview of the different ways to use Java in XPages and in the classic Domino app dev model.
There are different types of XPages developers. Stephan Wissel talks about three developer types, Chris Toohey about four stages. Here is my take on what different types of XPages developers there are (not counting IBM XPages product developers and non XPages developers):
- Developers who quickly assemble applications using Designer
Most XPages developers start in this category to get started with XPages. For some developers these techniques are sufficient when implementing simple form and/or workflow based applications.
- The ‘usual’ XPages developers building sophisticated business applications using Designer
I’ve included Java in this category because I see more and more people using Java in XPages and there are clearly advantages of Java. While Java used to be scary for some Domino developers some time ago I’ve seen a shift happening. As discussed in Henning Schmidt’s blog I think Java is simpler and better than SSJS for various reasons:
– You can reuse existing open source Java projects in XPages applications. This document (page 5ff) describes how to import some jar files into an NSF.
– You can debug the Java code.
– You can write managed beans. Karsten Lehmann has some good samples in this blogs.
– Java is a sophisticated language and there is a lot of documentation about core Java classes and JSF available in the internet.
Since 8.5.3 there is a Java design element. However to change config-faces.xml and in order to debug you need to use the Java perspective.
- Developers extending XPages functionality and Domino services using an Eclipse IDE
Used techniques: Deployment via OSGi bundles, development via Java in Eclipse
These developers need most skills but also can do more than others. The biggest difference to the two types above is that the deliverable is not an NSF but an Eclipse feature/OSGi bundle (deployable unit with potentially multiple plugins). The jar files can be deployed via the OpenNTF project plugins deployment or since 8.5.3 with the extended update site template (Declan Lynch describes this).
Using the Eclipse IDE and the extensibility API the core XPages functionality can be extended. This is used in the Extension Library and other OpenNTF projects like ZK spreadsheet and JQuery library. There are also simple extensibility samples on OpenNTF.
The second part of this video describes how to debug Java code from the Eclipse IDE. The OpenNTF project debug plugin allows debugging from Eclipse without having to redeploy the code to Domino in many/most cases.
In addition to the extensibility API you can also write full servlets. The OpenNTF project simple servlet shows how.
Furthermore you can extend the Domino server with OSGi tasklets. The project OSGi tasklet service proposes a new way of writing server addin tasks by using the Java OSGi programming model.
For completeness sake in the classic Domino app dev model you can implement agents and script libraries with Java. Bob Balaban describes in his blog how to write Java agents that you can debug in Designer or Eclipse (he calls this technique two headed beast).