做Extjs+Struts2文件上传、下载,做下载功能的时候一直爆[color=red]java.lang.ClassCastException: java.io.FileInputStream cannot be cast to java.lang.String[/color]这个错误,找了好久,发现原来是Struts2配置文件出错,
原代码如下:
<action name="downMachErrorDataAction" class="cn.org.genomics.health.solexaHlaPl.tongchou.action.DownMachErrorDataAction" method="getInputStream">
<result name="success" type="stream">
<param name="contentType">application/vnd.ms-excel</param>
<param name="contentDisposition">
attachment;filename =
"${fileName}"
</param>
</result>
</action>
修改成以下代码就OK了
<action name="downMachErrorDataAction" class="cn.org.genomics.health.solexaHlaPl.tongchou.action.DownMachErrorDataAction">
<result name="success" type="stream">
<param name="contentType">application/vnd.ms-excel</param>
<param name="contentDisposition">
attachment;filename =
"${fileName}"
</param>
<param name="inputName">inputStream</param><!--action的方法名-->
</result>
</action>