Over the last week I’ve been rather busy including some XPages functionality in an existing Domino web application, and as an example I wanted to explain why I chose XPages, some steps I took and the main challenge I encountered. XPages suited for this because:

  • We wanted the available documents to change depending on selections, so a view panel looking to a view filtered on key worked well.
  • We could easily allow users to process multiple documents depending on selections using viewPanel.getSelectedIds()
  • We could easily pull in information for multiple documents from multiple databases with good performance and show it with Dojo tooltips.
  • We could allow users to edit certain information at the time they’re selecting the documents.
  • We could seamlessly call a server agent with agent.runOnServer, use masks in the onStart and onComplete events of the partial refresh and redirect on success, in fewer lines than I have done in the past by coding an AJAX post.
  • We could use SSJS to easily pull only the relevant information I needed from the web page into a temporary document and get the values from that document in my agent. I have done an AJAX post in the past, pulling values from an HTML form. Considering the size of this page, in my opinion more coding would have been required in the whole process.
  • We were able to create a quite sophisticated report using XPages, using my temporary document and child documents created by the agent. The report shows all children, regardless of the amount of docuemnts run on, allowing details to be expanded and collapsed (individually or en masse) using client-side javascript in the same way as normal web development. The XPage allowed functions to be performed on each child document with partial refresh with minimal coding. By using SSJS as well I could refresh the repeat control of child data while retaining the view of which child details were expanded and which were collapsed.

This is not the first time I’ve included XPages design elements into an existing Domino web application – I did the same in my first use of XPages. I’m sure it won’t be my last.

The first steps to take the current subforms that comprised the skeleton of the site and recreate them in an XPages custom control. One of the benefits here was that I could consolidate several subforms into a single custom control with an Editable Area in the middle of the content. It also validates my HTML, unlike pass-thru HTML on a subform. And it can be auto-formatted using Ctrl + Shift + F.

As part of that I needed to include various resources, as well as a SSJS application initialisation script to pull paths to resource databases and some keywords into applicationScope variables. This is a basic bit of script in the beforePageLoad that begins “if (applicationScope.initApp==null)” and ends “applicationScope.initApp=true“.

Most time was spent implementing the existing stylesheets. This is not uncommon and I would always factor in time to fully reproduce the look and feel. The main area of frustration was styles allocated to elements by id, e.g.

#contentArea {position relative; margin-top 15px; margin-left: 15px;margin-bottom: 15px; margin-right 15px}

Anyone who has looked at the source HTML of an XPage knows element IDs get manipulated, and without that we couldn’t have repeat controls. But even if I added an HTML div with an id “contentArea” I still got unpredictable results. The solution was to create a custom stylesheet for use in XPages that allowed me to allocate these styles to classes instead. I’m not completely recreating the stylesheet, but I am including an additional stylesheet in XPages design elements. This does require additional maintenance if there are changes to the styles. Ideally if I was starting from scratch, I’d just use classes.

All of this is a fair amount of work, but if you’re planning on using XPages design elements in more of the application, as we are, it’s effort that will pay off in the long run. Once done I was ready to create my custom controls for the process. For its performance, flexibility and development time for the functionality compared to classic web, it was a worthwhile activity.

4 thoughts on “My recent work on XPages in an existing web app”

  1. Hello Paul,

    I just happend to see this video about “Creating a Live Text Widget to Launch an Authenticated XPage”. I’m quite impressed on this. Would it be nice if you can upload a demo db on this please? Again thanks for this wonderful video.

    Thank You.


  2. I’ve created a demo of it which will look up to your names.nsf, but I’m having a few problems trying to generate an extension.xml sample that can calculate hostnames etc.

    I’m also going to include creating a new recognizer, because I think that’s useful to know (e.g. pick up from a date and sow an XPage with documents based on that date). I’m on leave for a couple of days so might be able to make some progress. I will post more next week.

  3. Bernd Preusing

    Hello Paul,

    Just to see if you could provide a downloadable demo db for my learning purpose. I know, I’m troubling you on this, sorry about that.



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