1
在我的struts2应用程序中,我必须根据给定的值下载报告。在下载时,IE和Firefox会提示保存为对话框。但谷歌浏览器会自动下载下载文件夹中的报告。 我在谷歌搜索得到的答案就像我需要添加octect-stream到contentType头。我将它配置在我的struts xml中。仍然chrome不会提示保存为对话。Save as Dialogue显示在IE和Firefox中,但不显示在Google Chrome中
下面是我的代码
<action name="exportpsrdetails" class="com.action.Export_With_All">
<result name="success" type="stream">
<param name="contentType">application/vnd.ms-excel</param>
<param name="contentType">octet-stream</param>
<param name="contentDisposition">attachment;filename="ExportPsr.xls"</param>
<param name="inputName">excelStream</param> </result>
<result name="input">done.jsp</result>
<result name="login" type="redirect">login.jsp</result>
</action>
PS:我不应该在Chrome中更改设置,以显示另存为对话框
关于一般计算硬件和软件的问题,除非堆栈溢出直接涉及主要用于编程的工具,否则不适用堆栈溢出。您可以在超级用户上获得帮助。 –