2014-11-21 46 views
0
<p:dialog header="#{bundle['ref.details']}" id="detailsDial" 
        widgetVar="detailsDialog" style="max-width:800px"> 
        <p:button value="#{bundle['close']}" 
         onclick="PF('detailsDialog').hide()" /> 
       </p:dialog> 

对话框没有其他形式,对话框中没有形式。这是我想念的东西,但是什么。我不知道要提供哪些其他信息,因为真的不明白p:button会如何重新加载客户端页面?没有包含JavaScript。在萤幕控制台中也没有错误讯息。外面我使用模板是这样的:为什么关闭p:对话框正在重新加载页面

<!DOCTYPE html> 
<html lang="en" 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"> 
<h:body> 
<ui:composition template="/maintemplate.xhtml"> 
<ui:define name="content"> 
<p:dialog .... 

回答

1

移动从p:buttonp:commandButton命令按钮默认使用部分要求

  <p:dialog header="#{bundle['ref.details']}" id="detailsDial" 
       widgetVar="detailsDialog" style="max-width:800px"> 
        <p:commandButton value="#{bundle['close']}" onclick="PF('detailsDialog').hide();" type="button" /> 
      </p:dialog> 

理解上的差异就足以看出HTML是在一种或另一种情况下呈现,因此对于

<p:button value="Close" onclick="PF('detailsDialog').hide()" /> 

所提供的HTML是

<button type="button" onclick="PF('detailsDialog').hide();window.open('/ui/button.jsf','_self')" > 
    <span class="ui-button-text ui-c">Close</span> 
</button> 

按钮的功能GET请求,请注意window.open('/ui/button.jsf','_self')

<p:commandButton value="Close" onclick="PF('detailsDialog').hide()" />

呈现的HTML是

<button onclick="PF('detailsDialog').hide();PrimeFaces.ab({s:'j_idt19'});return false;" type="submit"> 
    <span class="ui-button-text ui-c">CloseCommandButton</span> 
</button> 

通知PrimeFaces.ab({s:'j_idt19'});return false;所以它发送一个partialUpdate代替提交封闭表格

+0

p:button和p:commandButton之间的区别是什么? – 2014-11-21 14:05:31

+1

我已更新答案以更好地反映差异,请参阅我的编辑 – 2014-11-21 14:20:15

相关问题