3
votes

I experience strange but reproduceable behaviour with an XPage which saves its values through a java bean. After copyAllItems to an document there are two richtext items in the document. First is empty, second is filled as expected.

This is my Xpage:

<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core"
xmlns:xc="http://www.ibm.com/xsp/custom">
<xp:this.data>
    <xp:dominoDocument var="docDataSource" formName="test"></xp:dominoDocument>
</xp:this.data>
<xp:div id="test">
    <xp:fileUpload id="fileUpload1" value="#{docDataSource.test}"></xp:fileUpload>
</xp:div>
<xp:button value="Label" id="button1">
    <xp:eventHandler event="onclick" submit="true"
        refreshMode="partial" refreshId="test">
        <xp:this.action><![CDATA[#{javascript:registration.testCopyAllItems(docDataSource);}]]></xp:this.action>
    </xp:eventHandler>
</xp:button>

This is my java bean method:

public void testCopyAllItems(DominoDocument docDataSource) throws NotesException{
    Document docUser = database.createDocument(); // <- get any database
    docDataSource.getDocument(true).copyAllItems(docUser, true);
    docUser.save();
}

This is the result in the document:

enter image description here

Does anyone have a hint on what could cause the trouble?

1
This seems to be a "normal" behaviour and I have seen it a lot working with RichtText fields. It shouldn't matter. Notes can deal with a RichText field constisting of more then one item. - Knut Herrmann
But when I want to programatically access the document to get the RichText Item I get an empty field. - Max
Then delete the RichText field after copyAllItems() with removeItem() and copy it with copyItem() separately in the hope that it results in one item only. - Knut Herrmann
That works for me. Write it as an answer so I can accept it. Thanks a lot! - Max
Great, thanks, I put this in an answer. - Knut Herrmann

1 Answers

2
votes

This seems to be a "normal" behaviour and I have seen it a lot working with RichtText fields. It shouldn't matter. Notes can deal with a RichText field constisting of more than one item.

As a workaround,

  • delete the RichText field after copyAllItems() with removeItem() and
  • copy it with copyItem() separately.

This should result in one item only.