HowTo: Vaadin on Domino (3)

Let’s create another application, based on Vaadin’s AddressBook example. You can download the source code directly or grab the code from the repository; it is a single class file named „AddressbookUI“ only.

After importing (or manually creating) the class in the HelloVaadin plug-in, the servlet configuration in „web.xml“ must be updated:

<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app version="2.5" xmlns="" 

        <description>Vaadin production mode</description>


The „<param-value>“ must contain the complete class name, I have additionally changed the name of the servlet and updated the path in the „plugin.xml„:

<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>



To connect the example to a Domino environment, the „createDummyDatasource“ method of the class must be replaced:

private static IndexedContainer createDummyDatasource() {

    // Domino objects
    Session session = null;
    Database db = null;
    View view = null;
    Document doc = null;
    Document tmpDoc = null;

    // initialize IndexedContainer
    IndexedContainer ic = new IndexedContainer();

    // add fieldnames as properties
    for (String p : fieldNames) {
        ic.addContainerProperty(p, String.class, "");

    // get all users from NAB
        // init Domino objects
        session = ContextInfo.getUserSession();
        db = session.getDatabase(session.getServerName(), "dummynames.nsf");
        view = db.getView( "People" );

        // process all documents in view
        doc = view.getFirstDocument();
        while (doc != null) {

            // create a new item
            Object id = ic.addItem();

            // add field values to the item
            ic.getContainerProperty(id, FNAME).
            ic.getContainerProperty(id, LNAME).

            // grab next document
            tmpDoc = doc;
            doc = view.getNextDocument(tmpDoc);
            recycle( tmpDoc );
    }catch(Exception e){
        recycle( doc, tmpDoc, view, db, session );
    return ic;

* recycle Domino objects
* @param objs
*     lotus.domino.Base objects to recylce
private static void recycle(Base... objs){
        for( Base obj:objs ){
            if( obj != null )
    }catch(Exception e){}

Because this is not rocket science I won’t get into the details.

To prevent anonymous access, I have added a simple redirection in the „init“ method:

protected void init(VaadinRequest request) {
    if( ContextInfo.isAnonymous() ){
         getPage().setLocation("/names.nsf?login=1&redirectto=" + 
             request.getContextPath() );

When opening the application as an anonymous user you will be automatically redirected to the Login Screen:

00 - Login

After signing in, domino redirects back to the addressbook example, and the list of persons in your „names.nsf“ is shown up:

00 - Addressbook

Dieser Beitrag wurde unter OSGi, Vaadin abgelegt und mit , , verschlagwortet. Setze ein Lesezeichen auf den Permalink.

2 Antworten zu HowTo: Vaadin on Domino (3)

  1. Daniele sagt:

    Sven, you are the you are the best in the XPages!!!

  2. Sultan sagt:

    Could you please share an eclipse project source?

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.