下面是后台action
@Action(value="copyBook",results={@Result(type="stream",params={"inputname","inputStream"})})
public String copyBookInfo()
{
HttpServletResponse response = ServletActionContext.getResponse();
HttpServletRequest request = ServletActionContext.getRequest();
response.setCharacterEncoding("UTF-8");
ByteArrayOutputStream output = new ByteArrayOutputStream();
String info="";
try
{
setBookId(Integer.parseInt(request.getParameter("bookId")));
planeCopyUtil.copyBook(bookId);
info="成功";
output.write(info.getBytes("UTF-8"));
inputStream=new ByteArrayInputStream(output.toByteArray());
output.close();
}
catch(Exception e)
{
e.printStackTrace();
}
return SUCCESS;
}
这是前台
function copy(){
var bookId = llbId();
$.ajax({
type: 'post',
dataType:"text",
data:{"bookId":bookId},
url: '/AirRecord3/copyBook',
cache: false,
success: function (data) {
alert(1);
},
error: function (msg) {
alert("异常"+msg);
}
});
}
出现这样的错误
Stacktraces
Unable to instantiate Action, com.xyc.actions.PlaneCopyAction, defined for 'copyBook' in namespace '/'Error creating bean with name 'com.xyc.actions.PlaneCopyAction': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private java.io.InputStream com.xyc.actions.PlaneCopyAction.inputStream; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [java.io.InputStream] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
表示我是初学者求大神指教
------解决思路----------------------
贴的代码里没看到
------解决思路----------------------
你的ajax进入到后台了么? 执行过程怎么样