struts2 :
public String readIMG(){
fileName = new Date().getTime() + ".gif";
return SUCCESS;
}
public InputStream getInputStream()
{
return cmsQLService.showImg(QL_ID);
}struts.xml :<action name="readIMG" class="cmsQLAction" method="readIMG">
<result name="success" type="stream">
<param name="contentType">image/gif</param>
<param name="inputName">inputStream</param>
<param name="contentDisposition">attachment;filename="${fileName}"</param>
<param name="bufferSize">4096</param>
</result>
</action>
ibatis : public InputStream showImg(String id) {
CmsqlInfo cmssql = (CmsqlInfo)getSqlMapClientTemplate().queryForObject("CMS_QL.showImg" , id);
Blob blob = cmssql.getOUT_FLOW_IMG();
if(blob == null)
{
return null;
}
try {
return blob.getBinaryStream();
} catch (SQLException e) {
e.printStackTrace();
}
return null;
}
<resultMap id="ibatorgenerated_BaseResultMapdownLoad" class="com.zwdt.po.CmsqlInfo" >
<result column="OUT_FLOW_IMG" property="OUT_FLOW_IMG" jdbcType="BLOB"/>
</resultMap>
CmsqlInfo 文件中已经定义啦 下面属性
private Blob OUT_FLOW_IMG;不是说struts2 只要提供一个InputStream 就行啦 ,为什么现在这个老是报
java.lang.IllegalArgumentException: Can not find a java.io.InputStream with the name [inputStream] in the invocation stack. Check the <param name="inputName"> tag specified for this action.这个错误,请知道的帮忙解答一下
图片是存储在数据库中的。 还有一个事情 如果图片不存在我应该怎样控制,以至于不报错?
public String readIMG(){
fileName = new Date().getTime() + ".gif";
return SUCCESS;
}
public InputStream getInputStream()
{
return cmsQLService.showImg(QL_ID);
}struts.xml :<action name="readIMG" class="cmsQLAction" method="readIMG">
<result name="success" type="stream">
<param name="contentType">image/gif</param>
<param name="inputName">inputStream</param>
<param name="contentDisposition">attachment;filename="${fileName}"</param>
<param name="bufferSize">4096</param>
</result>
</action>
ibatis : public InputStream showImg(String id) {
CmsqlInfo cmssql = (CmsqlInfo)getSqlMapClientTemplate().queryForObject("CMS_QL.showImg" , id);
Blob blob = cmssql.getOUT_FLOW_IMG();
if(blob == null)
{
return null;
}
try {
return blob.getBinaryStream();
} catch (SQLException e) {
e.printStackTrace();
}
return null;
}
<resultMap id="ibatorgenerated_BaseResultMapdownLoad" class="com.zwdt.po.CmsqlInfo" >
<result column="OUT_FLOW_IMG" property="OUT_FLOW_IMG" jdbcType="BLOB"/>
</resultMap>
CmsqlInfo 文件中已经定义啦 下面属性
private Blob OUT_FLOW_IMG;不是说struts2 只要提供一个InputStream 就行啦 ,为什么现在这个老是报
java.lang.IllegalArgumentException: Can not find a java.io.InputStream with the name [inputStream] in the invocation stack. Check the <param name="inputName"> tag specified for this action.这个错误,请知道的帮忙解答一下
图片是存储在数据库中的。 还有一个事情 如果图片不存在我应该怎样控制,以至于不报错?
struts2 不是只要提供一个InputStream方法就行了吗? 那如果我一个action种 想提供两种下载呢
想知道struts2他是怎么 查找的?