Posts Tagged ‘java’

18 Aug 2016

XPages Tip: Populating Date/Time fields in Notes Docs with Date or Time Only

In your XPages app, you can use an EditBox control and set it’s display type to be a Date/Time control with certain formats. 2 examples are Date only or Time only. This all works great, except when you want to save these values to a Notes Document either via SSJS or Java. The saved values are definitely stored correctly in a Date/Time field, but always contain both a date and time value.


Below is a snippet of an EditBox control set up as a Date Only component in an XPage or Custom control, bound to a Java bean of object type “Date”:

XPage Snippet for Date Only

Your Java logic to save this value to a NotesDocument will look something like this:

DateTime tempDate = null;
tempDate = session.createDateTime(bean.dateOnly);
doc.replaceItemValue("DateOnly", tempDate);

Sadly, in the NotesDocument Field Properties tab, the saved value contains both a date and time:

XPages Date Time Value



Thankfully, the solution is very simple. When you create your DateTime object in either Java or JavaScript, before adding it to the doc.replaceItemValue, do the following:

To remove the time from the Date/Time value:

tempDate = session.createDateTime(bean.dateOnly);
tempDate.setAnyTime();//This removes the time value
doc.replaceItemValue("DateOnly", tempDate);

To remove the date from the Date/Time value:

tempDate = session.createDateTime(bean.timeOnly);
tempDate.setAnyDate();//This removes the date value
doc.replaceItemValue("TimeOnly", tempDate);

The above java example is very similar to what you would do in SSJS as well.
As simple as that :)

13 May 2016

My 2 webinars on Optimus XPages: An explosion of techniques and best practices

I’m happy to announce that both my webinar presentations titled “Optimus XPages” are available for viewing.


The first part focuses on techniques and best practices on a high level, where most of the video is presentation slides with a few short demos at the end.

The second video is a lot more fast-past. Nearly the entire video is live code. I pretty much design an XPages Single Page App from start with explanations of what’s happening along the way.

You can delve straight into Part 2, but I do recommend watching Part 1 if you have another 1.5 hours to spare, as it really gives some great insight to how apps should be developed.

Optimus XPages – Part 1: An Explosion of Techniques and Best Practices

Optimus XPages – Part 2: The Deep Dive


I trust you will get great value-add out of these videos. I just want to thank TLCC and Teamstudio for giving me the opportunity to present.

See you on the other side :)
7 Dec 2015

John Jardin’s 2nd Session at IBMConnect 2016: Optimus XPages


So, to my utter surprise, my second Abstract for IBM Connect 2016 was approved. It’s titled “Optimus XPages: An Explosion of Techniques and Best Practices“. For a reference to my first Abstract, click here. Just so everyone knows, IBM Connect takes place at “The Hilton” in Orlando, Florida. My session “Optimus XPages” is scheduled for Monday the 1st February 2016 at 3:30pm.

I am extremely excited to be presenting this session. Over the past year I have implemented a number of solutions running on XPages, and I got to experience first hand the improvement in performance and overall user experience when comparing these solutions to ones I developed in the past. I feel I have come up with some serious practices that anyone can easily apply to make their applications work and feel fast and responsive, whether running on a local network or in the cloud.

Below is a rundown of my session:


AD-1074 – Optimus XPages: An Explosion of Techniques and Best Practices


Starting a new XPages project but not sure it’s going to be done right the first time? Do you have an existing application that doesn’t seem to have that “X” Factor? In this session John will demonstrate how XPages developers can apply proven techniques and best practices to take their applications to a game changing level.


  1. Rapidly develop responsive applications
  2. Improve user experience and response times with background and multi threaded operations
  3. Keep your XPages lightweight with code injection
  4. Create scheduled tasks the XPages way
  5. and much more.

I hope to see you all there :)

Cheers for now :)
14 May 2015

Java XSnippet Published: Translate an ArrayList to a Vector

Here is a Java XSnippet I published the other day on how to manually convert an ArrayList Object to a Vector Object.


Thanks to “Martin Rolph” and “Jesse Gallagher” for providing a much simpler method of getting the same result without having to use my XSnippet. I’ve decided to keep my XSnippet published as I do feel it will add value as a reference point.


Click here to view XSnippet

When binding Scoped Variables to a List Control in XPages, the values returned are defined as an ArrayList. You might want to convert these values into a Vector for whatever reason.

Quick Example of how to use XSnippet:

doc.replaceItemValue("MultiValueField", TranslateArrayListToVector(viewScope.get("Values"));

Martin’s and Jesse’s much better alternative:

doc.replaceItemValue("MultiValueField", new Vector(viewScope.get("Values")));
10 Jul 2013

XPages Video Tutorial: Signing a Notes Database using Java

In this video tutorial I show you how to sign a Notes Database using the Server’s ID via Java Code.

In Lotus Notes version 6, IBM introduced a new method for the NotesDatabase Object called “sign()”. this allowed you to sign either the current database or another database using your current Notes ID. The only issue with this is that the Sign Request would only work if triggered manually inside the Notes Client.

For XPages development, this becomes an issue because you cannot perform a NotesDatabase.sign() on the front-end of your XPages Application.

So without further adieu, here’s the Video :)