2017-01-21 11 views
0

私はコマンドボタンをクリックしてポップアップを開くダイアログフレームワークを試しています。問題は、プライムフェイスダイアログが常に表示されることです。助けてください、私は間違ったことをしましたか?Primefacesダイアログは常に表示されます

It looks like ...

問題は、データがすぐに表示されていることです。

のfaces-config.xmlに:

<application> 
     <action-listener>org.primefaces.application.DialogActionListener</action-listener> 
     <navigation-handler>org.primefaces.application.DialogNavigationHandler</navigation-handler> 
     <view-handler>org.primefaces.application.DialogViewHandler</view-handler> 
    </application> 

はここに私のコードです。

<!DOCTYPE html> 
<html xmlns="http://www.w3.org/1999/xhtml" 
    xmlns:h="http://java.sun.com/jsf/html" 
    xmlns:f="http://java.sun.com/jsf/core" 
    xmlns:p="http://primefaces.org/ui"> 

<body> 

<h:form> 
    <h:panelGrid columns="1" cellpadding="5"> 
    <p:commandButton value="Basic" type="button" onclick="PF('dlg1').show();" /> 

    <p:commandButton value="Modal" type="button" onclick="PF('dlg2').show();" /> 

    <p:commandButton value="Effects" type="button" onclick="PF('dlg3').show();" /> 
</h:panelGrid> 

<p:dialog header="Basic Dialog" widgetVar="dlg1" minHeight="40"> 
    <h:outputText value="Resistance to PrimeFaces is futile!" /> 
</p:dialog> 

<p:dialog header="Modal Dialog" widgetVar="dlg2" modal="true" height="100"> 
    <h:outputText value="This is a Modal Dialog." /> 
</p:dialog> 

<p:dialog header="Effects" widgetVar="dlg3" showEffect="explode" hideEffect="bounce" height="100"> 
    <h:outputText value="This dialog has nice effects." /> 
</p:dialog> 


</h:form> 

</body> 
</html> 
+0

primefacesのバージョンは何ですか? –

+3

あなたはh:headとh:bodyが必要です –

+0

これは通常のダイアログとよく似ていて、ダイアログフレームワークの質問ではありません。それはダイアログを表示するのではなく、その内容だけを表示します。 'ビューソース'を実行して重複を見つけてください。 – Kukeltje

答えて

0

あなたは顔-config.xmlが削除することができ、それが唯一のダイアログFramework用http://www.primefaces.org/showcase/ui/df/basic.xhtml

Jaqen H'gharが右だ、あなたは<h:head><h:body>を必要としています。ここに完全な例があります。

<!DOCTYPE html> 
<html xmlns="http://www.w3.org/1999/xhtml" 
    xmlns:h="http://java.sun.com/jsf/html" 
    xmlns:f="http://java.sun.com/jsf/core" 
    xmlns:p="http://primefaces.org/ui"> 
<h:head> 
    <title>Dialog Example</title> 
</h:head> 
<h:body> 

    <h:form> 
     <h:panelGrid columns="1" cellpadding="5"> 
      <p:commandButton value="Basic" type="button" 
       onclick="PF('dlg1').show();" /> 

      <p:commandButton value="Modal" type="button" 
       onclick="PF('dlg2').show();" /> 

      <p:commandButton value="Effects" type="button" 
       onclick="PF('dlg3').show();" /> 
     </h:panelGrid> 

     <p:dialog header="Basic Dialog" widgetVar="dlg1" minHeight="40"> 
      <h:outputText value="Resistance to PrimeFaces is futile!" /> 
     </p:dialog> 

     <p:dialog header="Modal Dialog" widgetVar="dlg2" modal="true" 
      height="100"> 
      <h:outputText value="This is a Modal Dialog." /> 
     </p:dialog> 

     <p:dialog header="Effects" widgetVar="dlg3" showEffect="explode" 
      hideEffect="bounce" height="100"> 
      <h:outputText value="This dialog has nice effects." /> 
     </p:dialog> 


    </h:form> 
</h:body> 
</html> 
+0

@jkleeありがとうございます。 – MusYa

関連する問題