Two Java Libraries To Know for XPages Development

Home » Two Java Libraries To Know for XPages Development

If you’re writing Java for your XPages applications (and Java tends to be my predominant language for application logic now), there are a couple of libraries well worth being aware of.

The first is only of use if you’re using the Extension Library, but to be honest virtually every XPages application I’m working on at this point in time uses the Extension Library. It’s ExtLibUtil, which has a wealth of very useful methods available for accessing XPages-related elements like scoped maps, sessions, xsp.properties, Extension Library version, XSPContext object, and ExtLibUtil.resolveVariable() which I use extensively. I can’t find an online javadoc for it, but if you’ve downloaded the Extension Library, you have access to all the source code. The class can be found in the com.ibm.xsp.extlib.core project, in com.ibm.xsp.extlib.util package.

The second I became aware of because of the Extension Library code. It is com.ibm.commons.util.StringUtil. From the javadoc I found, it looks like it first came in with 8.5.2.  This gives a load of handy methods for string manipulation.

Previously I’ve blogged about using org.apache.commons.lang.StringUtils as well as the challenges of working around security policies (note the second comment about adding it to a lib folder to use a different ClassLoader).

This is the main reason I’ve been using com.ibm.commons.util.StringUtils instead on more recent projects. The one major helper function missing is the equivalent of @Left and @Right, to get part of a string based on another string. But Jesse Gallagher has previously posted a Java class that has those kinds of methods.

Enjoy!

2 thoughts on “Two Java Libraries To Know for XPages Development”

    1. If you download it from OpenNTF, there are zip files suffixed -src.zip that have all the source Java code. It can be imported into Eclipse although you may need the XPages SDK from OpenNTF to avoid errors.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top