当我在主页中完全插入表单时,它可以工作,但是当我使用 ui:include 时它不会。
<!-- 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>
希望这能解释我的意图。我整天都在寻找答案,但没有成功。提前致谢。