我正在使用下载文件Struts2
。当我单击按钮下载文件时,文件将单独下载并在Excel中打开,而不是我要下载,当我右键单击该文件时,我应该可以打开或保存它。在中IE
,Firefox
我看到一个打开或保存文件的窗口,但是在Chrome
文件中,文件本身是在Excel中打开的。有什么办法可以Chrome
像Firefox
和IE
行动
public String viewReport() throws Exception {
boolean returnReport;
inputStream = new FileInputStream(DOCUSIGN_REPORT_FILE);
try {
returnReport = validateRequest();
if (returnReport) {
intgList = this.generateViewIntegrationReportData(getESignUIConfig());
this.createCSVFile(intgList, DOCUSIGN_REPORT_FILE);
} else {
failureResponse(msgs, 400);
return null;
}
} catch (Exception e) {
e.printStackTrace();
msgs.add(new Message(ESignatureIntegrationMessageTypeEnum.MESSAGE_TYPE_ERROR,
UiIntegrationKeyConstants.UI_INTEGRATION_ERROR_CODE_500, UiIntegrationKeyConstants.UI_INTEGRATION_ERROR_TEXT_SERVICE_ERROR));
failureResponse(msgs, 500);
return null;
}
return UiIntegrationKeyConstants.REPORT_REPSONSE;
}
Struts.xml
<action name="*Integration" method="{1}" class="foo.bar.ESignatureIntegrationAction">
<result name="success" type="tiles">integrationView</result>
<result name="reportResponse" type="stream">
<param name="contentType">application/text/csv</param>
<param name="inputName">inputStream</param>
<param name="contentDisposition">
attachment;filename="DocuSignEnvelopeReport.csv"
</param>
<param name="bufferSize">4096</param>
</result>
</action>
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句