2016-11-29 16 views
0

我有一个Xpage应用程序使用扩展库,其中xsp.extlib.convstate对于三个用户之一为'null',直到他们手动刷新页面为止。所有三个用户使用Citrix通过RDP访问应用程序,而所有三个用户的Internet选项都相同。试图弄清楚为什么会发生这种情况。该应用程序仅在一个9.0.1服务器上。xsp.extlib.convstate返回null

+0

这是他们第一次访问应用程序吗?什么时候它是空的?即你如何访问它? –

回答

0

从源代码的外观,如果有尚未初始化一个conversationState,该conversationState不会被初始化,直到:

  1. 在Render Response阶段(在阶段侦听后

    : com.ibm.xsp.extlib.component.layout.impl.ApplicationPhaseListener)

    @SuppressWarnings("unchecked") // $NON-NLS-1$ 
    public void afterPhase(PhaseEvent event) { 
        if(event.getPhaseId()==PhaseId.RENDER_RESPONSE) { 
         // After the render phase, we save the conversion state 
         ConversationState.saveInSession(event.getFacesContext()); 
        } 
    } 
    
  2. 在UIApplicationLayout的方法的setParent

    ,这似乎是由一个“isRestoringState”状态,说明我不加以防护不要以为这样的犯规d在页面的第一个视图上运行,因为没有任何状态可以恢复。

    @Override 
    public void setParent(UIComponent parent) { 
        super.setParent(parent); 
        if(null == parent){ // removing parent 
         return; 
        } 
    
        // TODO should move this initialization to initBeforeContents instead 
        FacesContextEx context = (FacesContextEx) getFacesContext(); 
        if(null != context && !context.isRestoringState()) { 
         ConversationState cs = ConversationState.get(context, FacesUtil.getViewRoot(this), true); 
    
         // Initialize the conversation state 
         // Set the current navigation path to the UserBean 
         ApplicationConfiguration conf = findConfiguration(); 
         if(conf!=null) { 
          String navPath = conf.getNavigationPath(); 
          if(StringUtil.isEmpty(navPath)) { 
           // If there isn't a navigation path that is defined, the use the default one 
           if(StringUtil.isEmpty(cs.getNavigationPath())) { 
            navPath = conf.getDefaultNavigationPath(); 
           } 
          } 
          if(StringUtil.isNotEmpty(navPath)) { 
           cs.setNavigationPath(navPath); 
          } 
         } 
        } 
    } 
    

因此,这或许可以解释为什么它不会被初始化,直到第2页视图。 您可以尝试在尝试使用它之前强制ConversationState的初始化,可能在beforePageLoad中,通过调用com.ibm.xsp.extlib.component.layout.ConversationState的get()方法之一。 注意布尔参数告诉方法创建ConversationState,如果它不存在。 我不做很多的ServerSide Javascript,但我想这个工程?情绪是正确的。

#{javascript: com.ibm.xsp.extlib.component.layout.ConversationState.get(facesContext, true); } 

如果你在Java做那么:

ConversationState.get(FacesContext.getInstance(), true); 

这听起来像你为什么看到你的行为的解释?

+0

该应用程序使用OneUILayout,因此尽管您的解释给出了某些原因,但考虑到此行为仅适用于3个用户中的一个,因此无法理解。 –

+0

对于第一个用户是否每个新页面都发生?或只为他们加载的第一页?他们都通过相同的初始url访问应用程序吗? –

+0

他们都通过相同的网址进行访问。由于我们现在已经删除了调试工具栏,我们不能再看到对话状态的值。感谢您的回答 –