2
目前我想下载的文件名称为“downloadStatistic.html”。我想把它改成“无论我想要什么”。顺便说一下,它是一个* .csv文件。如何更改struts中的下载文件名称
这里是我的下载操作的代码:
@Scope("prototype")
@Component("/downloadStatistic")
public class StatisticDownloadAction extends DownloadAction {
@Override
protected StreamInfo getStreamInfo(ActionMapping actionMapping,
ActionForm actionForm,
HttpServletRequest httpServletRequest,
HttpServletResponse httpServletResponse) throws Exception {
String filepath = httpServletRequest.getParameter("filepath");
String contentType = "text/comma-separated-values";
File file = new File(filepath);
return new FileStreamInfo(contentType, file);
}
}
这就是我的支柱XML:
<action
path="/shipmentStatistic"
name="shipmentStatisticForm"
scope="request"
validate="false"
type="de.logentis.struts.DelegatingActionProxy"
input="/jsp/statistics/ShipmentStatistic.jsp">
<forward name="back" path="/menu.html" redirect="true"/>
<forward name="download" path="/downloadStatistic.html?filepath={0}" redirect="true"/>
</action>
<action
path="/downloadStatistic"
type="de.logentis.struts.DelegatingActionProxy">
<forward name="back" path="/shipmentStatistic.html" redirect="true"/>
</action>
我在哪里可以定义下载文件的文件名?
工程...谢谢 –
我们随时欢迎您:] –