ApplicationContext ac = WebApplicationContextUtils.getWebApplicationContext(this.getServletContext());
IGatewayService gatewayService = (IGatewayService) ac.getBean("gatewayService");
gatewayService.createProductImage(productImage);
GatewayConfig gatewayConfig = (GatewayConfig) getServletContext().getAttribute("gatewayConfig");
PrintWriter out = response.getWriter();
String fileUrl = gatewayConfig.getUrl()+"/"+productImage.getSourceURL();
//CKEditorFuncNum就是在提交上传文件的同时传递到后台的request内容,表明应该插入到编辑器中的位置
String callback = request.getParameter("CKEditorFuncNum");
out.println("<script type=\"text/javascript\">");
out.println("window.parent.CKEDITOR.tools.callFunction(" + callback
+ ",'" + fileUrl + "',''" + ")");