1.在官网下载安装包,下载完成后如下:
2.将整个ueditor文件夹copy到项目的webapp目录下:
3.在WEB-INF文件夹下创建lib目录,并将.../ueditor/jsp/lib目录下的所有jar包copy进去
4.将这些jar包添加到项目的依赖中
5.配置ueditor.config.js文件
6.在jsp页面中使用ueditor:
引入js文件
在div中嵌入富文本编辑器
<div class="container margin-top-10">
<div class="col-sm-8">
<div class="panel panel-default">
<div class="panel-body">
<form method="post" name="newBlogForm" id="newBlogForm" action="${pageContext.request.contextPath}/newBlog.blog">
<input type="hidden" name="n_sid" id="n_sid" value="${student.sid}">
<div class="form-group">
<label>日志标题:</label><label class="control-label error-info" style="text-align:left;">*不能为空</label>
<input type="text" class="form-control" id="n_title" name = "n_title">
</div>
<div class="form-group">
<label>日志正文:</label><label class="control-label error-info" style="text-align:left;">*不能为空</label>
<!-- 加载编辑器的容器 -->
<script id="n_content" name="n_content" type="text/plain">${blog.content}</script>
<!-- 实例化编辑器 -->
<script type="text/javascript">
var ue = UE.getEditor('n_content');
</script>
</div>
<div style="text-align: right;">
<button type="submit" class="btn btn-success">发表</button>
</div>
</form>
</div>
</div>
</div>