我把上传的方法写在 action里面 单个图片上传没问题 批量上传根本进不去方法 请哪位高手帮忙看看
页面调用
var editor;
KindEditor.ready(function(K) {
editor = K.create('textarea[name="111"]', {
cssPath : '/components/kindeditor-4.1.3/plugins/code/prettify.css',
uploadJson : '/userGroup/grouppost_uploadImage.action',
allowFileManager : true,
items:[
'justifyleft', 'justifycenter', 'justifyright',
'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent',
'|', 'formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold',
'italic', 'underline', '|', 'image', 'multiimage'
],
afterCreate : function() {
var self = this;
K.ctrl(document, 13, function() {
self.sync();
document.forms['example'].submit();
});
K.ctrl(self.edit.doc, 13, function() {
self.sync();
document.forms['example'].submit();
});
}
});
});
action 方法
public String uploadImage(){
JSONObject json=new JSONObject();
List<String> arr = new ArrayList<String>();
try {
if(imgFile != null){
// 上传文件
for (int i = 0; i < imgFile.size(); i++) {
//这里是生成图片的方法
String imgPath=imageExecute(imgFile.get(i),imgFileFileName.get(i));
arr.add(imgPath);
}
}
} catch (Exception e) {
e.printStackTrace();
}
json.put("error", 0);
for(int i = 0; i < arr.size(); i++){
json.put("url", arr.get(i));
}
return renderText(json.toString());
}