我是 struts 2 的新手,我问是否有办法将变量参数传递给 struts 2 注释。
这是我已经做过的,但没有运气
public class DownloadFileAction extends ModuleGenericClass{
private InputStream inputStream;
private String fileName;
@Action(value="/downloadFile",results={
@Result(name="success",type="stream",params = {
"contentType",
"application/octet-stream",
"inputName","inputStream",
"bufferSize","1024","contentDisposition",
"filename=\"${fileName}\""})
})
public String execute() throws Exception {
fileName = "testing";
inputStream = //myInputStream
return SUCCESS;
}
public void setCourrierId(String courrierId) {
this.courrierId = courrierId;
}
public String getfileName() {
return fileName;
}
public void setfileName(String fileName) {
this.fileName = fileName;
}
public InputStream getInputStream() {
return inputStream;
}
public void setInputStream(InputStream inputStream) {
this.inputStream = inputStream;
}
}
我在网上搜索,但我发现只有 xml Struts 的解决方案,这不是我想要的 =(