Personal tools
XPages and Managed Bean: a new way to process Notes documents

Beans, beans, beans....

Feb 06, 2014

XPages and Managed Bean: a new way to process Notes documents

In this article I want to show an useful method to manage Notes documents using Managed Java Bean and Xpages, instead of the traditional way used so far

Starting from Lotus Domino 8.5, with coming of XPages but especially with the latest releases (9.0 and 9.1), application development is completely changed, especially if you are an "old-style" Domino developer.

XPages and Extension Library fully integrated, together with API as replacement for lotus.domino package, now provides a brand new approach to manage documents, and this is great in terms of performance and reusability.

From agents...

In old approach, to work with back-end document, it is directly mapped in agents using getDocumentContext(), after that document fields are read respectively with:

  • getItemValueString()
  • replaceItemValue()

methods. Xpages...

After XPages introduction, document bind is made directly into XPage itself:

     <xp:dominoDocument var="doc" formName="data_input"></xp:dominoDocument>
</> XPages Managed Java Bean!

Binding Java objects from documents is also faster ;-)

Starting from Lotus Domino 8.5.3 upgrade pack 1 is possible to use Managed Beans inside XPages. You can see a very useful guide here and a lot of other resources over the web.

Let us focus on the main goal of this topic: binding Java objects.

Most important reasons to bind Java objects rather then documents are:

  • keep your business logic in one place
  • cleaner code inside the object rather than on the XPage (reusability).

The entire logic behind is more or less this one:

  • load object from the document
  • provide getters and setters methods to access fields
  • provide methods for functionality
    • load, save, or anything needed
  • save variables in object back to document.

Another great advantage in this approach is that using Managed Beans there is no event handling, because the bean take automatically from the url, so it's very very fast in terms of web interface (no reload of page and so on).

I could sit here and explain the code in every way, but I think it's more effective to see the video (very clear and comprehensive).

You can see it starting from here (3 or more videos) and download Domino project from here.

Many thanks to David Leedy and Tim Tripcony for their great work!

Filed under: , , ,
comments powered by Disqus