我正在使用Facelet模板技术在我正在处理的JSF 2应用程序中布局我的页面.
在我的header.xhtml中,primefaces要求菜单栏包含在h:form中.
<h:form>
<p:menubar autoSubmenuDisplay="true">
Menu Items here!
</p:menubar>
</h:form>
Run Code Online (Sandbox Code Playgroud)
所以,在我的内容页面中,我将有另一个h:form或更多.
如果我只是将h:form放在我的template.xhtml中,它会起作用吗?
<h:body>
<h:form>
<div id="top">
<ui:insert name="header"><ui:include src="sections/header.xhtml"/></ui:insert>
</div>
<div>
<div id="left">
<ui:insert name="sidebar"><ui:include src="sections/sidebar.xhtml"/></ui:insert>
</div>
<div id="content" class="left_content">
<ui:insert name="content">Content</ui:insert>
</div>
</div>
<div id="bottom">
<ui:insert name="footer"><ui:include src="sections/footer.xhtml"/></ui:insert>
</div>
<h:form>
</h:body>
Run Code Online (Sandbox Code Playgroud)
我实际上正在考虑一个用例,我需要在页面中使用多个h:form.
谢谢
我在单击时显示对话框有问题。这是显而易见的,但我无法发现该错误。我已经坚持了好几天,这太疯狂了。你能帮我吗。
<h:form id="form">
<p:commandButton
rendered="#{characterBean.characterSession.characterName ne null}"
value="#{characterBean.characterSession.title.titleName}"
icon="fa fa-fw fa-edit" onclick="PF('dlg').show();"
update="@form"/>
<p:dialog id="titleDetail" header="#{i18n['title.yourTitles']}"
widgetVar="dlg" dynamic="true" closable="false" resizable="false"
showEffect="fade" hideEffect="fade">
<h:panelGroup>
<p:messages autoUpdate="true" />
<h:selectOneMenu id="titleSelect" converter="#{titleConverter}"
value="#{characterBean.characterSession.title}">
<f:selectItems value="#{characterBean.titleUnlocked}" var="t"
itemValue="#{t}" itemLabel="#{t.titleName}" />
</h:selectOneMenu>
<hr />
<h:panelGrid columns="2" style="width: 100%; text-align:center">
<p:commandButton value="#{i18n['general.submit']}"
icon="fa fa-check"
actionListener="#{characterBean.updateCharacterTitle}"
oncomplete="PF('dlg').hide();" update="@form" />
<p:commandButton value="#{i18n['general.cancel']}"
icon="fa fa-close" action="#{characterBean.submitCancel}"
oncomplete="PF('dlg').hide();" update="@form" process="@this" />
</h:panelGrid>
<p:remoteCommand name="updateForm()" process="@this" update="@form" />
</h:panelGroup>
</p:dialog>
</h:form>
Run Code Online (Sandbox Code Playgroud)