SpringMVC+Ueditor 整合
springMvc ueditor整合主要需要处理以下几件事情
1、基于官方jsp改写springMvc Controller;
2、后端config.json配置;
3、前端ueditor.config.js配置
基于官方jsp改写springMvc Controller
Ueditor官方demo
http://ueditor.baidu.com/website/
jsp官方demo配置
http://fex.baidu.com/ueditor/#server-jsp
maven项目构建
项目包目录结构
com.baidu.ueditor 对应百度相关类,从jsp项目中拷取
com.platform.contoller springMvc controller 改写
核心代码
UEditorController
Upload图片访问设置路径 saveFilePath
BinaryUploader改写
注意一点: 原ueditor使用项目相对路径存储文件,本文增加了路径参数
可以自己指定路径。
http://localhost:8080/platform/ueditor/config?action=config&&noCache=1517061389699 至此,基于springMvc ueditor服务端改造工作告一段落。
后端config.json配置
配置文件里面主要有两个参数
前缀可以使用固定地址,使用nginx进行代理
增加mySavePath参数,指定上传图片存储位置
前端ueditor.config.js配置
1、后台config路径请求地址配置
2、toolbar配置
3、ueditor自定义高度设置