我使用## Ofbiz模板下载##文件。目前的pdf文件下载以相同的名称始终。我需要设置PDF文件的名称。如何动态设置文件名?在其他一些问题中,我看到我们必须设置响应头“内容处理”,但在ofbiz中不确定在哪里设置它。任何答案或指示都是有帮助的。
我的controller.xml
<view-map name="InvoicePDF" type="screenfop"
page="component://myapp/widget/OrderScreens.xml#InvoicePDF" content-type="application/pdf" encoding="none"/>我的OrderScreens.xml
<!-- PDF Screens -->
<screen name="InvoicePDF">
<section>
<actions>
<property-map resource="AppUiLabels" map-name="uiLabelMap" global="true"/>
<service service-name="getInvoiceDetails" auto-field-map="true"/>
</actions>
<widgets>
<platform-specific>
<xsl-fo><html-template location="component://myapp/webapp/myapp/static/pdf/invoicePrint.fo.ftl"/></xsl-fo>
</platform-specific>
</widgets>
<fail-widgets>
<label style="h3" text="${uiLabelMap.PrintPermission}"/>
</fail-widgets>
</section>
</screen> 发布于 2017-12-01 19:33:42
我尝试了一个选项,它可以为我工作-我在actions标记中添加了一个新的groovy脚本,如下所示:
<script location="component://myapp/webapp/myapp/WEB-INF/actions/setContentDisposition.groovy"/>setContentDisposition.groovy
import javax.servlet.*;
import javax.servlet.http.*;
filename = invoiceNumber +"_" + month + ".pdf";
response.setHeader( "Content-Disposition", "attachment;filename=" + filename );https://stackoverflow.com/questions/47566409
复制相似问题