March 30, 2012

Recycle() XPages repeat control?

I`m currently looking into memory management in Lotus Notes XPages applications. I understand that ideally every domino object should be recycled, especially when looping large collections and new`ing up large amounts domino objects.

What about the xp:repeat control? When I set a large NotesViewEntryCollection as value for a repeater (by just calling database.getView('x').getAllEntries()), how should this be recycled? Does it have to be recycled? The documents are commonly used further on in the repeater by calling 'curItem.getColumnValues()[x]' to build up the xpages content.

January 13, 2012

XPages fileupload control and mime types

I have a problem uploading an image to a form field using the built in xpages fileuploader control. The form field the image is saved to is configured like explained in this blog post by Mats Knutsen: . I Also plan to display the image in an xpage using the template described in the blog post, like this (http://server/MyDatabase.nsf/viewunid/docunid/imageField/M2?OpenElement).

I know my fileuploader control points to the correct field in the form, since i can see the image in the document using the Lotus Notes Client after the document is created. However; the picture can not be viewed using "http://server/MyDatabase.nsf/viewunid/docunid/imageField/M2?OpenElement" at this point.

On the other hand, if I delete the field contents (the image) from the document field in the client, go back to the xpage with the fileuploader control, and uploads the image a second time, it works perfectly, and the image can be viewed using the url mentioned above.

This image shows my xpages fileupload control code:

This image displays the field properties of the field in the document the image is saved to the first time the fileuploader is used:

If I then delete the contents of the field in the picture above, and re-enters the document in the xpage, uploading the image once again using the file uploader, everything works fine, and i get the field properties of the document as displayed below:

Does anyone know why my file uploader control does not work the first time i upload the image, but when I edit the document and upload the image a second time, everything seems to be ok?