358 Lotus blogs updated hourly. Who will post next? Home | Downloads | Events | Pods | Blogs | Search | myPL | About 
Sorry, no records were found!
Latest 7 Posts
Searching multiple databases in Xpages and realtime sortable results.
Sat, Aug 13th 2011 34
Xpages and Java tip:- how to save a Java object to a Notesdocument
Fri, Aug 5th 2011 41
Xpages : Here is how to create a clearable textbox!
Tue, Jun 28th 2011 40
Xpages Debug Custom Control v2.0 released on OpenNTF
Sun, Jun 26th 2011 31
Tip: a quicker way to document your Xpage custom controls
Wed, Jun 15th 2011 31
OpenNTF We4IT Contest - Xpages Captcha Custom Control
Wed, May 18th 2011 31
Source Sniffer v3.0 - released on OpenNTF soon...
Thu, May 5th 2011 27
Top 10

Xpages and Java tip:- how to save a Java object to a Notesdocument
Ferry Kranenburg    

Using replaceItemValueCustomData and getItemValueCustomData to store Java objects in NotesDocuments.

When using Java to save information from Java objects to documents in Xpages you probably came across the question: I have an Java object but I can’t save it easily to a document. For example, in my case I had a java.util.ArrayList containing java.util.HashMap objects that I would like to save to a notesdocument.

In this case I thought I had to convert my data somehow to a java.lang.Vector of strings  and save it to a multivalue field in the Notes Document, so I could retrieve it back later, convert the Vector of strings somehow to my ArrayList of Hashmaps….

And then I came across ‘notesdocument.replaceItemValueCustomData’ and ‘notesdocument.getItemValueCustomData’. This function is capable to put my Arraylist without any conversion in the notesdocument. When I need it later, it is pretty easy to retrieve it back using this function and it’s returning the exact same object I saved in the document!

You can save this kind of data to any field in your Notes Document. The result is an ‘Arbitrary Data’ type of field.










Do not expect to save lot’s of exotic classes and objects to a NotesDocument this way because the field is limited to 64KB. Also, it is not very easy to retrieve these values in Lotusscript but it is not impossible, Stephan Wissel blogged about this a while ago.

Here is a code example:




Aug 05, 2011
42 hits

Sorry, no records were found!
Recent Blog Posts

Created and Maintained by Yancy Lent - About - Blog Submission - Suggestions - Change Log - Blog Widget - Advertising - Mobile Edition