当 XPage 上存在多个 IFrame 时,无法设置 sessionScope 变量 [英] Cannot set sessionScope variable when multiple IFrames are present on a XPage

查看:18
本文介绍了当 XPage 上存在多个 IFrame 时,无法设置 sessionScope 变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含多个 IFrame 的 XPage(xBase"),每个都在我的数据库中显示一个 XPage(xIFrame").单击 xBase 中的按钮时,会设置 sessionScope 变量,并部分刷新显示此变量的标签(请参阅示例代码).只要 IFrame 不多,以这种方式显示变量就可以正常工作.在下面的简短演示示例中,显示最多只能使用 3 个 IFrame,但一旦出现 4 个或更多,则不再设置 sessionScope 变量.

I have a XPage ("xBase") containing multiple IFrames, each showing a XPage ("xIFrame") in my database. When clicking on a button in xBase, a sessionScope variable is set and a label showing this variable is partially refreshed (see example code). Displaying the variable this way works fine as long as there are not too many IFrames. In the short demo example below the display only works up to 3 IFrames, but as soon as there are 4 or more present, the sessionScope variable is not set anymore.

我在 Notes Client 8.5.3、Firefox 13.0.1 和 Safari 5.1.7 中测试了给定的示例,结果相同.部分刷新本身似乎没有问题,因为刷新显示当前时间的标签可以正常工作.谁能告诉我是什么问题?

I tested the given example in Notes Client 8.5.3, Firefox 13.0.1 and Safari 5.1.7 - with the same result. It does not appear to be a problem with the partial refresh itself because refreshing a label showing the current time works properly. Can anybody please tell me what the problem is?

XPage "xBase":

<?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.beforePageLoad><![CDATA[#{javascript:sessionScope.remove("testvar");}]]></xp:this.beforePageLoad>

<xp:div id="divIFrames">
<iframe src="xIFrame.xsp?para0=abc" id="iframe0" name="iframe0"></iframe>
<iframe src="xIFrame.xsp?para0=def" id="iframe1" name="iframe1"></iframe>
<iframe src="xIFrame.xsp?para0=ghi" id="iframe2" name="iframe2"></iframe>
<iframe src="xIFrame.xsp?para0=jkl" id="iframe3" name="iframe3"></iframe>
<iframe src="xIFrame.xsp?para0=mno" id="iframe4" name="iframe4"></iframe>
</xp:div>
<xp:br/>

<xp:button value="refresh iframes" id="button0">
    <xp:eventHandler event="onclick" submit="true" refreshMode="partial" refreshId="divIFrames"></xp:eventHandler>
</xp:button>
<xp:br/><xp:br/>

<xp:label id="label"><xp:this.value><![CDATA[#{javascript:new Date().toUTCString()+": "+sessionScope.containsKey("testvar")}]]></xp:this.value></xp:label>
<xp:br></xp:br>

<xp:button value="set sessionScope / refresh label" id="button1">
    <xp:eventHandler event="onclick" submit="true"
        refreshMode="partial" refreshId="label">
        <xp:this.action><![CDATA[#{javascript:sessionScope.put("testvar","STRING");}]]></xp:this.action>
    </xp:eventHandler>
</xp:button>

</xp:view>

XPage "xIFrame"(只是一个显示时间和网址的标签 > 简单以确保它不会导致问题):

XPage "xIFrame" (just a label showing time and url > simple to ensure it is not causing the problem):

<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">
<xp:label value="#{javascript:new Date().toUTCString()+':'+context.getUrl().toString()}"></xp:label>
</xp:view>

推荐答案

添加问题即可解决

xsp.persistence.tree.maxviews=16

xsp.persistence.tree.maxviews=16

到您数据库的 xsp.properties 文件,然后清理项目.16 的值是任意的,只要确保它大于您计划使用的 IFrame 数即可.

to your database's xsp.properties file and afterwards cleaning the project. The value of 16 is arbitrary, just make sure it's higher than the number of IFrames you plan to use.

所有功劳都归功于提供此解决方案的 Sven Hasselbach 和 Per Henrik Lausten.

这篇关于当 XPage 上存在多个 IFrame 时,无法设置 sessionScope 变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆