永发信息网

Can not find a java.io.InputStream with the name [inputStream] in the invocation stack.

答案:2  悬赏:50  手机版
解决时间 2021-03-04 22:38
Can not find a java.io.InputStream with the name [inputStream] in the invocation stack. Check the tag specified for this action.
这个错误在网上查了很多,都说是路径问题,我的struts2配置是用注解方式写的,
action:
private HumanService humanService = null;
private InputStream excelStream;
get,set方法.......
@Action(value = "/HR/Data/excel", results = { @Result(name = "excel", type = "stream") }, params = {
"contentType", "application/vnd.ms-excel", "contentDisposition",
"attachment;filename=export.xls", "inputName", "excelStream" })
public String excel() throws Exception {
StringBuffer excelBuf = new StringBuffer();
excelBuf.append("编号").append("\t").append("身份证号").append("\t").append(
"一卡通号").append("\t").append("定级工资").append("\t").append("入职日期")
.append("\t").append("备注").append("\n");
List list1 = humanService.listHumans();
for (int i = 0; i < list1.size(); i++) {
HumanInfo humanInfo = (HumanInfo) list1.get(i);
excelBuf.append(humanInfo.getHuman_ID()).append("\t").append(
humanInfo.getHuman_IdNo()).append("\t").append(
humanInfo.getHuman_Bank()).append("\t").append(
humanInfo.getHuman_Percentage()).append("\t").append(
humanInfo.getHuman_EntryDate()).append("\t").append(
humanInfo.getHuman_State()).append(
"\n");
}
// excelBuf.append("Thinking in
// Java").append("\t").append("2001").append("\t").append("Eckel").append("\n");
// excelBuf.append("Spring in
// action").append("\t").append("2005").append("\t").append("Rod").append("\n");
String excelString = excelBuf.toString();
// logger.debug("result excel String: " + excelString);
excelStream = new ByteArrayInputStream(excelString.getBytes(), 0,
excelString.length());
return "excel";

}
jsp页面: onClick="javascript:window.location.href='excel.action'" />
希望大家可以帮帮忙,困扰很久了
最佳答案
要什么功能就对着电脑喊,会有那么一天电脑通人性了,就自动帮你改好了。
全部回答
空指针,做一个判断,当不为空的时候才进行操作。 !=null
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
我昨天去做了激光去痣,今天伤口边缘有点红,
三男一狗没中文地图吗
(11分)下图表示碳在植物和人体内的转移途径,
我的自行车人家借去骑要是受伤了我没有责任吧
山东省德州市到夏津县汽车站有多远 5分
宜采用武火加热的炮制方法是A.麸炒B.米炒C.砂
初中女生的英文名字
有顾客想买阿胶但是你想介绍阿胶口服液要跟顾
关于我国地理位置叙述正确的是AA. 亚欧大陆东
怎样评价笔或纸的品质
求一个街机游戏《三国战记》原版的下载地址?
急需一个没人用过的相亲YY频道名和马甲格式
徐老师来巡山地91期背景音乐就EZ那个?
金正男在中国有三个女人 金正男的老婆是谁
目前家用热泵空调除霜是用什么方法,是停机除
推荐资讯
含有渔的词语有哪些
下述可以确诊早孕的是A.恶心、呕吐B.停经C.乳
三分之一X的平方减去二x等于二
成语反义词什么胜什么汰
久客女性高潮液喷剂有用吗
商业房产权证 最多可以写几个名字
图片pdf怎么转换成文本?或者有什么浏览软件
衰的形近字组词
个人独资企业的个人所得税是否能申请定额征收
金华幼小衔接班在哪里啊,我有事要去这个地方
阅读下面的名著选段,回答下面问题。(5分)
120G固态好,还是1000G机械硬盘好
正方形一边上任一点到这个正方形两条对角线的
阴历怎么看 ?