【发布时间】:2013-02-04 12:17:17
【问题描述】:
我阅读了很多关于这个问题的帖子,但找不到解决方案。
我的 JSF 开头有一个带有命令按钮的表单,它应该会打开对话框。 Dialog 在 Dialog 内部有一个表单,以及属性 modal 和 appendToBody。我的页面只是自行重新加载,不会弹出对话框。
<ui:composition template="../templates/site.xhtml"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:sec="http://www.springframework.org/security/tags">
<ui:define name="content">
<h:form>
<p:commandButton value="Button" id="myButton" onclick="myDialog.show()" />
</h:form>
<p:dialog id="dialog" widgetVar="myDialog"
header="Dialog" closable="true" resizable="false" width="600"
height="350" modal="true" appendToBody="true" dynamic="true">
<h:form>
...
</h:form>
</p:dialog>
</ui:define>
</ui:composition>
【问题讨论】:
-
你能不能再发
commandButton代码,看起来像科学怪人。 -
另外发布一些代码,也许你有一些嵌套的
form标签... -
是的,对不起。我已经编辑了我的命令按钮。嗯,有两种形式,一种在命令按钮外,一种在对话框内,还有 ui:define 和 ui:composition 外
标签: forms jsf dialog primefaces modal-dialog