2012-07-25 46 views
0

當我完全插入主頁面中的表單時,它工作正常,但是當我使用ui時:include它不。ajax更新不能在UI裏面工作:構圖

<!-- Main JSF --> 
<html xmlns="http://www.w3.org/1999/xhtml" 
    xmlns:h="http://java.sun.com/jsf/html" 
    xmlns:p="http://primefaces.org/ui" 
    xmlns:ui="http://java.sun.com/jsf/facelets"> 
    <h:head> 
    <title>Facelet Title</title> 
    </h:head> 
    <h:body> 
    <ui:include src="main.xhtml" /> 
    </h:body> 
</html> 

<!-- to be included --> 
<ui:composition xmlns="http://www.w3.org/1999/xhtml" 
      xmlns:h="http://java.sun.com/jsf/html" 
      xmlns:ui="http://java.sun.com/jsf/facelets" 
      xmlns:p="http://primefaces.org/ui"> 
    <h:form> 
    <h:outputLabel value="ID" for="userId" /> 
    <p:inputText value="#{managedEmployee.userId}" /> 
    <p:commandButton value="Show" update="result" /> 
    <p:panel id="result"> 
     <h:outputText value="#{managedEmployee.userId}" /> 
    </p:panel> 
    </h:form> 
</ui:composition> 

希望這解釋了我的意圖。 我一直在尋找答案,但沒有成功。提前致謝。

回答

0

就關閉這個票,我發現這個問題對我的問題就在這裏,使用錯誤的bean的引用,有點笨我知道..

0

嘗試改變(有斜槓):

<ui:include src="/main.xhtml" /> 
+0

剛試過,但不起作用。包含的頁面已加載,但更新不起作用。 – mokuril 2012-07-25 13:35:49

+0

你在日誌中有一些例外嗎? 頁面加載後userId的值是否可見? – tomi 2012-07-25 13:47:59

+0

當我運行該應用程序時,顯示如下:警告:無法查找ID爲userId的組件。 – mokuril 2012-07-25 14:18:31

0

這可能是因爲您要包含在文件中,你需要使用標籤。

閱讀this教程非常仔細。它解釋了很多。