xpages error when trying to access edit mode in client notes

无人久伴 提交于 2019-12-24 03:16:26

问题


I'm trying to open some doc. from a viewPanel inside the client notes. The application also runs on web.

When I open the doc. in read mode, and then click the Edit button:

<xp:button value=" Editare" id="buttonEdit"
            rendered="#{javascript:!currentDocument.isEditable()}" >

        <xp:eventHandler event="onclick" submit="true" refreshMode="complete">
            <xp:this.action>
                <xp:changeDocumentMode mode="edit" var="Contr"></xp:changeDocumentMode>
            </xp:this.action>
        </xp:eventHandler>
</xp:button>

I get the following error:

Exception

java.lang.String incompatible with javax.faces.model.SelectItem

this it happens only in notes client.

From the stack trace:

 com.sun.faces.renderkit.html_basic.MenuRenderer.getOptionNumber(Unknown Source)
 com.sun.faces.renderkit.html_basic.MenuRenderer.renderSelect(Unknown Source)
 com.sun.faces.renderkit.html_basic.MenuRenderer.encodeEnd(Unknown Source)
 com.ibm.xsp.renderkit.html_basic.MenuRenderer.encodeEnd(Unknown Source)
 .... .... 

After deleting one by one combos, I noticed that the error is at this one, which values are:

var a = [].concat(@Unique(@DbColumn(dbname, "vwA", 0))).sort();
var b = @Unique(@DbColumn(@DbName(),"vwB",0));
return a.concat(b);

Any ideas why/ and how can I fixed this issue?


回答1:


It is very likely that the error comes from your SSJS variable dbname. Please double check which value is set to this variable.

I get the same error java.lang.String incompatible with javax.faces.model.SelectItem if dbname is a string instead of an array.




回答2:


Sadly, stack traces don't help me much when isolating an error. However, I can guess that your problem is that the value of a selectItems (plural) is set to a string rather than something with multiple values. A selectItem (singular) can have a string as it's value, but not a selectItems (plural).

So, this set of selectItems for a combobox is valid:

<xp:selectItems>
    <xp:this.value><![CDATA[#{javascript:applicationScope.globalSettings.allCurrencies}]]></xp:this.value>
</xp:selectItems>

As is this one:

<xp:comboBox id="emailTypeCB1" value="#{newOrgDoc.EMailType}">
    <xp:this.defaultValue><![CDATA[#{javascript:var keywordChoices = new TS_Keywords();
var tmp = keywordChoices.Lookup("Contact / email types", true);
return keywordChoices.getDefaultValue();}]]></xp:this.defaultValue>
    <xp:selectItem itemLabel="-- choose --" id="selectItem14">
    </xp:selectItem>
    <xp:selectItems id="selectItems12">
        <xp:this.value><![CDATA[#{javascript:return new TS_Keywords().Lookup("Contact / email types", true);}]]></xp:this.value>
    </xp:selectItems>
</xp:comboBox>

But, if I tried this, it wouldn't work if the viewScope.myChoices was a string and not something with multiple values:

<xp:comboBox id="emailTypeCB1" value="#{newOrgDoc.EMailType}">
    <xp:selectItems id="selectItems12">
        <xp:this.value><![CDATA[#{javascript:viewScope.myChoices;}]]></xp:this.value>
    </xp:selectItems>
</xp:comboBox>

I would assume that the difference is not just that you opened one in XPiNC and one in the browser, but that the value was set differently in each - ending up as a string when you were in Notes.



来源:https://stackoverflow.com/questions/25863015/xpages-error-when-trying-to-access-edit-mode-in-client-notes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!