2016-11-18 5 views
0

まず、jsfを使ったWebアプリケーション開発の初心者であることを知っておく必要があります。p:mediaまたはp:documentViewer with p:dialog dynamic

pdfファイルの説明とダイアログボックスに表示するボタン(このファイルをダウンロード、コピー、または印刷できないようにする必要があります)を示す表を作成する必要があります。私も使用している

<h:body> <ui:composition template="/template/plantilla.xhtml"> <ui:define name="content"> 
     <h:form id="frmpdf"> 
      <div align="center"><h:outputText value="Docs .PDF" style="font-weight: bold;"/> 
      </div> <p:dataTable id="dtdpdf" 
         var="dpdf" 
        value="#{documentosPdfBean.listdocpdf}" > 

       <p:column headerText="Descrip" style="width: 90%;"> 
        <h:outputText value="#{dpdf.sgTfd_descripcion}" /> 
       </p:column> 
       <p:column headerText="Open"> 
       <p:commandButton value="open" 
            oncomplete="PF('dlg3').show();" 
            update="frmpdf:dlgpdf" /> 
       </p:column> 
      </p:dataTable> <p:dialog id="dlgpdf" header="document" widgetVar="dlg3"    showEffect="explode" height="100" dynamic="true"> 
       <p:media value="/resources/document/manual.pdf" width="100%" height="300px"/> 
        </p:dialog>       
       </h:form> 
      </ui:define> 
     </ui:composition>    
    </h:body> 

<p:commandLink title="manual" onclick="PF('dlg3').show()" /> 

result

私はと、ダイアログボックスを表示するときには、文書が表示されていない、これは私のコードであると私のすべての可能性を使い果たしてしまいました

これを考慮してこれを考慮に入れてpost

答えて

0

さらに研究を重ねると、タグ0123で問題を解決することができましたこのイベントがトリガされた豆からの値を確立することを可能にする、私は溶液でコードを残す:

<f:view> 

<h:head> 
    <title>Page</title> 
    <script type="text/javascript" src="/js/keyboard.js" charset="UTF-8"></script>  
    <link rel="stylesheet" type="/text/css" href="/js/keyboard.css" /> 
</h:head>  

<h:body> 
    <ui:composition template="/template/plantilla.xhtml"> 
     <ui:define name="content"> 
      <h:form id="frmpdf"> 
       <f:event listener="#{documentPdfBean.onPrerender}" type="preRenderView" /> 
       <div align="center"> 
        <h:outputText value="Docs. PDF" style="font-weight: bold;" /> 
       </div> 
       <p:dataTable id="dtdpdf" var="dpdf" value="#{documentPdfBean.listdocpdf}" > 
        <p:column headerText="Descrip" style="width: 90%;"> 
         <h:outputText value="#{dpdf.sgTfd_descripcion}" /> 
        </p:column> 
        <p:column headerText="open"> 
         <p:commandLink styleClass="fa fa-file-pdf-o" onclick="PF('dlgpdf').show()" 
             update="frmpdf:pdfvisualizer" style="width: 10px; font-size: 20px; margin-left: 24%;"> 
          <f:setPropertyActionListener target="#{documentPdfBean.ruta}" value="#{dpdf.sgTfd_valor}" /> 
         </p:commandLink> 
        </p:column>        
       </p:dataTable>                 
       <p:dialog widgetVar="dlgpdf" height="700" width="750" header="pdf" maximizable="true" minimizable="true" 
          resizable="false" dynamic="true" showEffect="clip"> 
        <pe:documentViewer height="700" id="pdfvisualizer" value="#{documentPdfBean.ruta}" /> 
       </p:dialog> 
      </h:form> 
     </ui:define> 
    </ui:composition>    
</h:body> </f:view> 

ビーン

private String ruta; 

public String getRuta() { 
    return ruta; 
} 

public void setRuta(String ruta) { 
    this.ruta = ruta; 
} 
関連する問題