legacy-knowledge-base
公開されました Jul. 2, 2025

Primefaces: commandButton ajax="false" は p:dataExporter と p:fileDownload で動作しません。

written-by

Alfonso Crisci

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

legacy-article

learn-legacy-article-disclaimer-text

問題

  • Primefaces <p:commandButton ajax="false" />p:dataExporterp:fileDownloadで使用すると、ページが正しくレンダリングされず、視覚的な問題が発生します。

環境

  • Liferay DXP 7.0+

解像度

  • p:dataExporterp:fileDownload をポートレットで使用する場合、それぞれ別のフォームに入れるのがベストプラクティスです。 非Ajax UICommand コンポーネントが p:dataExporter または p:fileDownloadを持つフォームに含まれている場合、JSFポートレットで失敗します。

    下のようなものです:
    <h:body>
    <h:form>
    <p:commandButton value="commandButton ajax=false doesn't work" ajax="false" />
    </h:form>
    <h:form>
    <h1>not working example - contains PrimeFaces dataExporter</h1>
    <p:dataTable id="tabledata" var="r" value="#{controller.tabledata}">
    <h:outputText value="this is the header where the button was" />
    <p:commandButton ajax="false" value="csv export">
    <p:dataExporter target="tabledata" type="csv" fileName="tabledata" />
    </p:commandButton>
    </f:facet>
    <p:column>
    <h:outputText value="#{r}" />
    </p:column>
    </p:dataTable>
    <p:commandLink value="switch to working example" action="working" />
    </h:form>
    なるように変更するものとする:
     <h:body>     
    <h:form>
    <p:commandButton value="commandButton ajax=false doesn't work" ajax="false" />
    <h1>not working example - contains PrimeFaces dataExporter</h1>
    <p:dataTable id="tabledata" var="r" value="#{controller.tabledata}">
    <h:outputText value="this is the header where the button was" />
    <p:commandButton ajax="false" value="csv export">
    <p:dataExporter target="tabledata" type="csv" fileName="tabledata" />
    </p:commandButton>
    </f:facet>
    <p:column>
    <h:outputText value="#{r}" />
    </p:column>
    </p:dataTable>
    <p:commandLink value="switch to working example" action="working" />
    </h:form>

追加情報

did-this-article-resolve-your-issue

legacy-knowledge-base