一、下载 https://ueditor.baidu.com/website/index.html
将ueditor放到项目中合适的位置
二 、 配置文件上传路径
在utf8-jsp/jsp/config.json文件中更改文件长传路径
三 、自定义工具类
在utf8-jsp/ueditor.config.js中自定义工具类
四、 前端使用
// 引用
// 使用
内容
// 初始化
//实例化编辑器
//建议使用工厂方法getEditor创建和引用编辑器实例,如果在某个闭包下引用该编辑器,直接调用UE.getEditor('editor')就能拿到相关的实例
var ue = UE.getEditor('hdxy');
/* ue.addListener("ready", function () {
// editor准备好之后才可以使用
ue.setContent("${faq.answer}", false);
}); */
五、后台使用
try {
notice.setContent(editorValue); // 获取富文本编辑器中的所有内容
Matcher m = Pattern.compile("]*>([^").matcher(editorValue);
while (m.find()) {
// System.out.println(m.group(1)); // 获取a标签内的内容
String filepath = m.group(0);// 获取整个a标签
notice.setFilepath(filepath);
}
noticeService.updateNotice(notice);
response.getWriter().println(1);
} catch (Exception e) {
response.getWriter().println(0);
}