日期:2014-05-16  浏览次数:20370 次

struts2 返回json对象弹出下载框

public void kexcute() {
doAjax(new AjaxAction() {

@Override
public Map<String, Object> execute() {

UploadInfo ui = uploadUtil.uploadFile(imgFile, imgFileFileName, getSubfolder());

rs.put("url", ui.getUrl().toString());

rs.put("fileName", save(ui));

rs.put(AjaxAction.INCLUDE_FIELDS, new String[]{"id","fileName", "path", "originalName", "link", "description","url","message_code","error"});
//以下参数编辑器用
rs.put("error", 0);
return rs;
}
});
}