我遇到了JSF/Primefaces显示弹出窗口的问题。作为背景,我使用JSF模板生成我的页面:p:对话框不显示
内联工作显示数据表,但是当我单击按钮显示对话框时,什么都不会发生。我在日志中看不到任何错误。
<h:body>
<p:dataTable id="lstUsers" var="u" value="#{userController.userList}" selectionMode="single"
selection="#{userController.selectedUser}" rowKey="#{u.login}" paginator="true" rows="10">
<p:column headerText="Username">
<h:outputLabel value="#{u.login}"></h:outputLabel>
</p:column>
<p:column headerText="Role" rowspan="2">
<h:outputLabel value="#{u.role}"></h:outputLabel>
</p:column>
<f:facet name="footer">
<p:commandButton id="bttAdd" type="button" value="Add" update=":contentView:idPanelPop" oncomplete="userDialog.show()" ></p:commandButton>
<p:commandButton id="bttEdit" value="Edit"></p:commandButton>
<p:commandButton id="bttRemove" value="Remove"></p:commandButton>
</f:facet>
</p:dataTable>
<p:dialog id='userDialog' header="User Details" widgetVar="userDialog"
resizable="false" width="200px" height="200px" showEffect="clip" hideEffect="fold">
<h:panelGrid id="idPanelPop" columns="2">
<h:outputLabel id='dOutUser' value="Username"></h:outputLabel>
<h:outputLabel id='dOutUserValue' value="#{userController.selectedUser.login}"></h:outputLabel>
<h:outputLabel id='dOutRole' value="Role"></h:outputLabel>
<h:outputLabel id='dOutRoleValue' value="#{userController.selectedUser.role}"></h:outputLabel>
</h:panelGrid>
</p:dialog>
</h:body>
上面的代码被用作
<ui:composition template="./maintemplate.xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:ui="http://java.sun.com/jsf/facelets">
<ui:define id="contentViewIndex" name="content">
<ui:include src="#{navigationController.currentPage}"></ui:include>
</ui:define>
</ui:composition>
我的模板页面的部分包括以下内容:
<p:layoutUnit position="center">
<h:form id="contentView">
<ui:insert name="content">
Default Content
</ui:insert>
</h:form>
</p:layoutUnit>
的navigationController.current价值变动按菜单点击导航横跨页面。 我正在关注的公报primafaces展示PrimeFaces datatable
我目前的设置是Netbeans的7.3 RC1 /阿帕奇7.0.34.0 /钻嘴鱼科2.1.13
我会appreacite如果有人可以点我朝着正确的方向解决这个:)
编辑:考虑到内联的答案没有什么作品。 也许我应该先检查浏览器控制台,在这种情况下,它很奇怪,因为它抱怨它不识别widgedVar。 我已经试图把对话框外部的窗体和结果是相同的错误。 :/
可能的重复:http://stackoverflow.com/q/14381602/1530938 – kolossus 2013-02-11 14:26:42
感谢您的提示,但不幸的是发生了什么不适用于我的情况。我的表单是模板的一部分,它内部调用需要呈现的页面。这样我可以在网站中导航并动态更新内容。 我会尽量让页面作为独立的,看看它是否工作。 – 2013-02-11 15:03:49