QUINDIP: how to set field values with java (or DominoDocument the magic animal)

Old approach:

   XspInputText field = (XspInputText) StandardUtil.findComponent(facesContext .getViewRoot(), “countryName”);

The annoying thing about this approach: You never know exactly which class the component has, ie. a “read only” field is not XspInputText etc., and thus you cannot just use this approach really transparently.

New approach:

DominoDocument dominoDoc = StandardUtil.getDominoDocument();
dominoDoc.replaceItemValue(“editableField”, new Date().toString());

It works for editable/hidden/disabled/readOnly fields!!!

And the best thing is: you do not even need to know the fields xPage name anymore! 

You only care about set in the binding property. This in effect speeds up development a lot, cause I do not need to check/modify field names in 2 places anymore.

the getDominoDocument works like this:

DominoDocument dominoDoc = (DominoDocument) JSFConnector
return dominoDoc;

and the JSFConnector you will find here (kudos to Karsten Lehmann)


  1. You can make this even simpler using the DataObject methods on DominoDocument. Since it implements the DataObject interface, you can skip a lot of type-conversion works and just do…

    dominoDoc.setValue("editableField", new Date());

    Which means you can also just do…


    Using these methods instead of replaceItemValue and getItemValueString/Integer/Double etc, you can future-proof your code so it doesn't matter whether you're using Domino as your datasource. You could change it to a REST service, XML, RDBMS, Couchbase, or anything else capable of implementing the com.ibm.xsp.model.DataObject interface, and you're all set.

  2. Hi Nathan
    Thanks for this great tip! Excellent… (tested it and it works.. heavenly…)

    I know I don't know too much about all that stuff and I know I am not the only one out there having similar problems, that's why I try to tell about my experiences.

    And if people like you give me feedback on my stuff that makes me feel very proud. It looks like my blog indeed has in the meantime reached a certain crowd.

    Thanks a lot


Leave a Reply

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

The reCAPTCHA verification period has expired. Please reload the page.