是這樣的,我寫了重載了兩個getInputStream方法,當調用不帶參數的方法時,運行正常,當調用帶參的方法則報 Can not find a java.io.InputStream with the name [inputStream] in the invocation stack的錯誤
代碼如下:
Struts2配置:
<action name="ajaxUserDataExportAction" class="com.action.AjaxUserDataExportAction">
<result type="stream">
<param name="ContentType">application/vnd.ms-excel</param>
<param name="inputName">inputStream</param>
<param name="contentDisposition">filename="user.xlsx"</param>
</result>
</action>
spring配置
<bean id="userManageService" class="com.hy.serviceimp.UserManageService">
<property name="baceDaoImp" ref="baceDaoImp"></property>
</bean>
調用代碼:
調用帶參數的getInputStream,程序報錯
public InputStream getInputStream()
{
System.out.println(userManageService.getInputStream(curPage, pageSize, sortName, sortOrder, searchValue)==null);
return userManageService.getInputStream(curPage, pageSize, sortName, sortOrder, searchValue);
}
調用不帶參數的,則運行正常
public InputStream getInputStream()
{
System.out.println(userManageService.getInputStream()==null);
return userManageService.getInputStream();
}
錯誤已經找到,是數據插入錯誤引起的