这是选项卡容器中的错误吗?

Is this a bug in the Tab Container?

我认为这是选项卡容器中的错误...

使用 Java 或服务器端 JavaScript createTab 方法打开新选项卡,当新选项卡包含一个面板,该面板设置为指向同一数据库中另一个 XPage 的 iframe 时总是导致 XPage 在加载大约五六个选项卡后重新加载(在 Chrome 中,IE 做同样的事情,但它需要更多的选项卡...)

如果选项卡包含一个指向另一个保存 XPage 的数据库的 iframe,它工作正常。

SSJS 代码是: getComponent("djTabContainer1").createTab({title:"New tab"});;

Java代码是

public static boolean createTab(UIDojoTabContainer tabContainer) {

    try {
        if (tabContainer == null) {
            tabContainer = (UIDojoTabContainer) Utils.findComponent("TabContainer");
            if (tabContainer == null) {
                return false;
            }
        }

        String tabTitle = null;
        String url = null;
        String unid = null;
        UIDojoTabPane newTab = null;

        // get default number from current project preferences
        tabTitle = "My Tabpage";
        url = Utils.GetXpageURL("tabpage.xsp");

        // create a new Tab
        newTab = new UIDojoTabPane();
        newTab.setTitle(tabTitle);
        newTab.setTabUniqueKey(new Random().toString());

        newTab.setClosable(true);
        newTab.setId("TabContainer_" + unid);
        newTab.setStyleClass("myTabContainer");

        Utils.WriteToConsole("setting style class on " + newTab.getTitle());
        // newTab.setStyle("height:auto;width:auto; overflow-y: auto;border: 0px;");

        // create new Panel
        UIPanelEx newPanel = new UIPanelEx();
        newPanel.setId("IFrame" + unid);
        newPanel.setStyleClass("iframeClass");
        // make an iFrame of this panel with our URL as src
        newPanel.setTagName("iframe");
        Attr property = new Attr();
        property.setName("src");
        property.setValue(url);
        newPanel.addAttr(property);

        // add Panel to our new Tab
        newTab.getChildren().add(newPanel);

        // add the new tab to our tab container
        tabContainer.getChildren().add(newTab);
        tabContainer.setSelectedTab(unid);
        return true;
    } catch (Exception ex) {
        Utils.WriteToConsole("Unable to add a new Tab Page to the Tab Container (com.tlcc.Main.createTab)", ex);
        return false;
    }

}

iframe 的 src 属性 中引用的 XPage 非常基础...

<?xml version="1.0" encoding="UTF-8"?>
 <xp:view xmlns:xp="http://www.ibm.com/xsp/core">
<xp:button
    value="Label"
    id="button1">
</xp:button>
<xp:inputText id="inputText1"></xp:inputText></xp:view>

当 XPage 重新加载时,它没有更多选项卡(除了开始时在 XPage 中创建的第一个选项卡)并且没有响应。

霍华德

可能是服务器页面 persistence/component 树限制问题。如果您使用默认服务器页面持久性,服务器仅在内存中存储 4 个页面(每个用户)。

当您在加载另一个 XPage 的页面上创建新选项卡时,服务器正在填满服务器页面持久性队列,当您点击第 5 个选项卡时,当前页面不再是服务器页面持久性的一部分(组件树不再在内存中)导致重新加载当前页面。

您可以增加存储的页数(也可以移动磁盘持久性而不是内存持久性)。您还可以在 iframe 中加载的 XPage 上将 viewState 设置为 "nostate"(至少可以验证我的理论)。

Toby Samples blog post on state and this answer on a similar state issue:

因此,要完成此操作...viewstate=nostate 的设置允许更多选项卡,但不会将组件保留在内存中。因此,它适用于只读 XPage,但当 XPage 上的文档处于编辑模式时效果不佳。在持久性选项卡的 Xsp 属性中设置磁盘上的最大页面数将允许更多带有 iframe 的选项卡,这些选项卡具有 XPage,但在某些时候仍然会崩溃。

Net 是,不要使用从同一个 nsf 拉入 XPage 的多个 iframe...