Ich lade eine Datei mit Struts2
. Wenn ich auf die Schaltfläche klicke, um die Datei herunterzuladen, wird die Datei in Excel heruntergeladen und geöffnet. Ich möchte sie herunterladen und wenn ich mit der rechten Maustaste darauf klicke, kann ich sie entweder öffnen oder speichern. In IE
und Firefox
bekomme ich ein Fenster, um die Datei zu öffnen oder zu speichern, aber in Chrome
wird die Datei in Excel selbst geöffnet. Gibt es eine Möglichkeit, es in Chrome
wie Firefox
und IE
Download-Datei mit Struts2 mit einer Eingabeaufforderung
Aktion hat
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>
Sie sind Andrea genial. Du hast meine Frage verstanden und ohne weitere Untersuchung hast du geantwortet, wonach ich gesucht habe. Mir wurde gesagt, dass es ein Browserverhalten ist, aber niemand wusste, wie es zu beheben ist. Vielen Dank noch einmal. – Jaykumar