2015-07-21 45 views
1

我认为这是Tab容器中的一个错误...这是一个Tab容器中的错误吗?

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

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

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中创建的第一个选项卡)并且没有响应。

Howard

回答

0

因此,要完成这个......对于视图状态设置= nostate允许更多的标签,但随后不留组件在内存中。所以,它只适用于只读XPage,但不适用于XPage上的文档处于编辑模式。在持久性选项卡的Xsp属性中磁盘上设置最大页数将允许更多带有XPage的iframe的选项卡,但仍会在某个时间点崩溃。

网络是,不要使用多个内部框架,从相同的NSF拉入XPages ...

4

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

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

您可以增加存储的页数(也可以移动磁盘持久性而不是内存持久性)。您也可以将viewState设置为在您加载到iframe中的XPage中“取消”(至少要测试我的理论)。

Toby Samples blog post on state和这个答案就类似状态问题:https://stackoverflow.com/a/31431917/785061

+0

每个几乎肯定是在正确的轨道在这里。 “当前XPage”的定义也可能是一个因素。当你最初加载父XPage时,这将是当前页面。但是如果你在iFrame中加载另一个XPage,我认为iFrame中的XPage被认为是当前页面,在这种情况下,父页面的持久化方法将变为在磁盘上,就好像你已经从父项页面添加到iFrame页面。 –

+0

这似乎在我的测试用例数据库中。明天将尝试“真正”的应用程序。谢谢Per !!!! – Howard