struts2奇葩问题之 no result define

struts的配置如下:

<package name="default" extends="struts-default">
    <action name="down" class="test.struts.Down">
        <result  name="down" type="stream">
            <param name="contentType">application/octet-stream</param>
            <param name="inputName">bis</param>
                <param name="contentDisposition">attachment;filename="${downloadFileName}"</param>
                <param name="bufferSize">100000</param>  
        </result>
    </action>
    
    </package>

public InputStream bis;
    public String downloadFileName;

//下面是getter   and   setter方法省略了

public String download() {
        try{
        File file=new File("C:\\12.doc");
        FileInputStream fis = null;
        try {
            fis = new FileInputStream(file);
        } catch (FileNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
         bis=new BufferedInputStream(fis);
         downloadFileName="12.doc";
         System.out.println();
         }catch(Exception e){
             e.printStackTrace();
         }
        return "down";

运行时会报

No result defined for action test.struts.Down and result down

这个错误,,找了半天是action的name属性的原因,,改成其他的就好了,,不过不知道为什么


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值