我有一個Xpage應用程序使用擴展庫,其中xsp.extlib.convstate對於三個用戶之一爲'null',直到他們手動刷新頁面爲止。所有三個用戶使用Citrix通過RDP訪問應用程序,而所有三個用戶的Internet選項都相同。試圖弄清楚爲什麼會發生這種情況。該應用程序僅在一個9.0.1服務器上。xsp.extlib.convstate返回null
回答
從源代碼的外觀,如果有尚未初始化一個conversationState,該conversationState不會被初始化,直到:
- 在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()); } }
- 在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);
這聽起來像你爲什麼看到你的行爲的解釋?
該應用程序使用OneUILayout,因此儘管您的解釋給出了某些原因,但考慮到此行爲僅適用於3個用戶中的一個,因此無法理解。 –
對於第一個用戶是否每個新頁面都發生?或只爲他們加載的第一頁?他們都通過相同的初始url訪問應用程序嗎? –
他們都通過相同的網址進行訪問。由於我們現在已經刪除了調試工具欄,我們不能再看到對話狀態的值。感謝您的回答 –
- 1. null == null返回false?
- 2. PropertyInfo.GetValue(null,null)返回null
- 3. UsbDevice.FromIdAsync返回null
- 4. ContentResolver.insert返回null
- 5. BitmapFactory.decodeByteArray()返回NULL
- 6. glXChooseFBConfig返回NULL
- 7. {this.props.children}返回null
- 8. findViewByID返回null
- 9. Assembly.GetType返回null
- 10. `DataGridViewComboBoxCell`返回`null`
- 11. cvCapturefromCAM()返回NULL
- 12. .getJSON()返回null
- 13. Android:BitmapFactory.decodeResource返回null
- 14. JAXB返回null
- 15. objectForKey:NSFileType返回NULL
- 16. UIImagePickerControllerMediaMetadata返回null
- 17. GetEditMenu()返回NULL
- 18. xlApp.ActiveWorkbook返回null
- 19. HashMap返回null
- 20. editText.getText()返回null
- 21. Wicket:getModelObject返回null
- 22. Nodelist.item返回null
- 23. getLayoutParams返回null?
- 24. SetWindowHookEx()返回NULL
- 25. addOBject返回NULL?
- 26. LocationManager返回null
- 27. BluetoothAdapter.getDefaultAdapter();返回null
- 28. imagecopyresampled返回null
- 29. DeviceClient.GetTwinAsync()返回null?
- 30. URLWithString返回null
這是他們第一次訪問應用程序嗎?什麼時候它是空的?即你如何訪問它? –