您的位置:首页 > 编程语言 > Java开发

struts2奇葩问题之 no result define

2016-04-01 13:42 495 查看
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属性的原因,,改成其他的就好了,,不过不知道为什么
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: