Jsf 2 Facelet组件ui:组合未向托管bean传递值
我有一个包含四个部分的页面(页眉、菜单、内容和页脚);为此,我使用了Jsf 2 Facelet组件ui:组合未向托管bean传递值,jsf-2,facelets,uiinclude,Jsf 2,Facelets,Uiinclude,我有一个包含四个部分的页面(页眉、菜单、内容和页脚);为此,我使用了ui:include。在内容部分,有一个inputText和一个commandButton(提交)。当我按下submit按钮时,我输入的inputText值不会传递给bean。我无法使用null(输入文本值)执行我的函数 索引页: <h:body > <p:poll interval="1" /> <div style="background-color: #E6E
ui:include
。在内容部分,有一个inputText
和一个commandButton
(提交)。当我按下submit按钮时,我输入的inputText值不会传递给bean。我无法使用null(输入文本值)执行我的函数
索引页:
<h:body >
<p:poll interval="1" />
<div
style="background-color: #E6E6FA;border-width: 1px; border-color: blue; border-style: solid;">
<ui:insert name="header">
<ui:include src="header.xhtml" />
</ui:insert>
</div>
<br />
<div
style="background-color: #E6E6FA; border-width: 1px; border-color: blue; border-style: solid;">
<ui:insert name="menubar">
<ui:include src="menubar.xhtml" />
</ui:insert>
</div>
<br />
<div
style="background-color: #E6E6FA;border-width: 1px; border-color: blue; border-style: solid; border-width: 1px; min-height: 700px;">
<ui:insert name="content" id="mainpage">
<ui:include src="#{menuBarBean.menuBarDTO.page}.xhtml" ajax="true"/>
</ui:insert>
</div>
<br />
<div
style="background-color: #E6E6FA;border-width: 1px; border-color: blue; border-style: solid;">
<ui:insert name="footer">
<ui:include src="footer.xhtml" />
</ui:insert>
</div>
</h:body>
</html>
内容页:
<body bgcolor="E6E6FA">
<ui:composition>
<h:panelGrid id="panel" columns="2" border="1" cellpadding="10"
cellspacing="1">
<f:facet name="header">
<h:outputText value="Adding Project" />
</f:facet>
<h:outputLabel value="ProjectName" />
<p:inputText id="emailId"
value="#{addProjectBean.addProjectDTO.projectName}" required="true"
validatorMessage="input needed">
</p:inputText>
<h:commandButton action="#{addProjectBean.addNewProject}"
value="Submit" ajax="false" />
<h:commandButton value="#{msg['prometheus_reset']}"
style="margin-right:20px;">
<p:ajax update="panel" resetValues="true" />
</h:commandButton>
</h:panelGrid>
<h:outputLabel name="loginCheck"
value="#{loginBean.loginDTO.message}" style="color:red">
</h:outputLabel>
</ui:composition>
</body>
在ui:composition中使用ajax=“false”而不是ajax=“true”
<ui:include src="#{menuBarBean.menuBarDTO.page}.xhtml" ajax="true"/>
已更新
<ui:include src="#{menuBarBean.menuBarDTO.page}.xhtml" ajax="false"/>
值正在传递给托管bean,一切正常。我建议退一步,在深入研究JSF之前,先学习一些基本的HTML。