图片可以上传已经存入数据库,但是页面没有显示,求大神解救,这是我的代码:
@RequestMapping(value = "/CKEditoruploadFile", method = RequestMethod.POST)
@ResponseBody
public String CKEditoruploadFile(@RequestParam("upload") MultipartFile[] files,HttpServletRequest httpServletRequest,HttpServletResponse httpServletResponse) throws IOException {
Map<String, Object> appInfo = new HashMap<String, Object>();
String callback = httpServletRequest.getParameter("CKEditorFuncNum");
ArrayList<Integer> arr = new ArrayList<Integer>();
String filename = "";
String filepath = "";
String urlpath="";
long filesize=0;
long MAXSIZE=30*1024*1024;
String uploadPath = "";
logger.info("开始加载config.properties配置文件信息。。。。。。");
PropertiesLoader propsLoader = (PropertiesLoader) BeanUtil.getBean("propertyProcesser", PropertiesLoader.class);
uploadPath =propsLoader.getProperty("upload.path");
File dir1 = new File(uploadPath);
if (!dir1.exists())
dir1.mkdirs();
SysUserMVO sessionUser = com.cattsoft.system.security.SecurityManager.getSessionUser();
httpServletResponse.setContentType("text/plain; charset=UTF-8");
PrintWriter out1 = httpServletResponse.getWriter();
for (int i = 0; i < files.length; i++) {
MultipartFile file = files[i];
if (!file.isEmpty()) {
InputStream in = null;
OutputStream out = null;
filename = file.getOriginalFilename();
filesize = file.getSize();//获取文件的字节大小,单位byte
if(filesize>MAXSIZE){
logger.error("文件大小超过限制:", "Files limited");
out1.println("<script type=\"text/javascript\">");
out1.println("window.parent.CKEDITOR.tools.callFunction(" + callback + ",''," + "'文件大小不得大于600k');");
out1.println("</script>");
out1.flush();
return null;
}
filename= StringUtils.isNotBlank(filename) == true ?
new String(filename.getBytes("ISO-8859-1"), "UTF-8") : StringUtils.EMPTY;
filename=filename.replaceAll("[;/?:@&=+$,# ! ~ * ']","\\_");//使用正则表达式将数字字母替换为_
String fileName=filename.substring(0, filename.lastIndexOf("."));//文件名
String prefix=filename.substring(filename.lastIndexOf(".")+1,filename.length());//文件名后缀
if (!prefix.equals("jpg")&&!prefix.equals("png")&&!prefix.equals("gif")&&!prefix.equals("bmp")) {
logger.error("文件格式不正确:", "Files limited");
out1.println("<script type=\"text/javascript\">");
out1.println("window.parent.CKEDITOR.tools.callFunction(" + callback + ",''," + "'文件格式不正确(必须为.jpg/.gif/.bmp/.png文件)');");
out1.println("</script>");
out1.flush();
return null;
}
filename = fileName+"."+prefix;
try {
/**
* 查询登录用户信息
*/
String userid=sessionUser.getSysUserId();
String path=uploadPath +"/"+userid;
//String path=httpServletRequest.getSession().getServletContext().getRealPath("upload/files/product/"+userid);
File dir = new File(path);
if (!dir.exists())
dir.mkdirs();
filepath = path +"/"+ filename;
urlpath = "/"+userid+"/"+ filename;
File serverFile = new File(path +"/"+ filename);
in = file.getInputStream();
out = new FileOutputStream(serverFile);
byte[] b = new byte[1024];
int len = 0;
while ((len = in.read(b)) > 0) {
out.write(b, 0, len);
}
out.close();
in.close();
logger.info("Server File Location=" + filepath);
} catch (Exception e) {
arr.add(i);
} finally {
if (out != null) {
out.close();
out = null;
}
if (in != null) {
in.close();
in = null;
}
}
} else {
arr.add(i);
}
}
if(arr.size() > 0) {
logger.error("上传失败:", "Files upload fail");
out1.println("<script type=\"text/javascript\">");
out1.println("window.parent.CKEDITOR.tools.callFunction(" + callback + ",''," + "'系统错误,文件上传失败!');");
out1.println("</script>");
out1.flush();
return null;
} else {
try {
AttachmentMVO attachmentMVO =(AttachmentMVO) model;
attachmentMVO.setAttachmentname(filename);
attachmentMVO.setAttachmentpath(filepath);
//attachmentMVO.setAttachmenttype(filetype);
attachmentMVO.setFilesize(Long.toString(filesize));
attachmentMVO=attachmentDelegate.insert(attachmentMVO);
out1.println("<script type=\"text/javascript\">");
out1.println("window.parent.CKEDITOR.tools.callFunction(" + callback + ",'" + attachmentMVO.getAttachmentpath() + "','')");
out1.println("</script>");
} catch (AppException e) {
e.printStackTrace();
out1.println("<script type=\"text/javascript\">");
out1.println("window.parent.CKEDITOR.tools.callFunction(" + callback + ",''," + "'系统错误,文件上传失败!');");
out1.println("</script>");
out1.flush();
return null;
}
}
out1.flush();
return null;
}

里面的内容是:
<script type="text/javascript">
window.parent.CKEDITOR.tools.callFunction(1,'D://work2//execl///10220/(408).jpg','')
</script>