Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

primefaces download file

<script type="text/javascript">
    //<![CDATA[
    function start() {
        PF('statusDialog').show();
    }

    function stop() {
        PF('statusDialog').hide();
    }
    //]]>
</script>

<div class="card">
    <p:dialog modal="true" widgetVar="statusDialog" header="Status" draggable="false" closable="false"
              resizable="false">
              <i class="pi pi-spinner pi-spin" style="font-size:3rem"></i>
    </p:dialog>

    <h:form>
        <p:commandButton value="Download" ajax="false" onclick="PrimeFaces.monitorDownload(start, stop);"
                         icon="pi pi-arrow-down" styleClass="p-mr-2">
            <p:fileDownload value="#{fileDownloadView.file}"/>
        </p:commandButton>

        <p:commandButton value="Ajax Download" icon="pi pi-arrow-down" styleClass="ui-button-outlined">
            <p:fileDownload value="#{fileDownloadView.file}"/>
        </p:commandButton>
    </h:form>
</div>
Source by www.primefaces.org #
 
PREVIOUS NEXT
Tagged: #primefaces #download #file
ADD COMMENT
Topic
Name
8+3 =