第一:百度UEditor编辑器的官方下载地址
ueditor 官方地址:http://ueditor.baidu.com/website/index.html
第二:将编辑器复制到相关工程的WebRoot中,并将jsp/lib下的jar导入工程的WEB-INF/lib下
第三:配置ueditor.Config.js
只需修改 var URL=“XXX”
如下:
第四:配置jsp/config.json(图片上传路径)
只需修改imageUrlPerfix=“XXX”
如下:
第五:jsp页面引入编辑器
A.
<link rel="stylesheet" href="utf8-jsp/themes/default/css/ueditor.css" type="text/css"/>(在head中加入)
B.实例化编辑器对象(在body中加入):
<textarea id="myEditor" name="content" style="width:500px;height:300px;margin:0 auto;" onBlur="myEditor()">
</textarea>
C.导入js:(在body中)
<script type="text/javascript" src="utf8-jsp/ueditor.config.js"></script>
<script type="text/javascript" src="utf8-jsp/ueditor.all.js"></script>
<script type="text/javascript">
var ue=UE.getEditor('myEditor',{
toolbars:[
['fullscreen','source','undo','redo','bold','italic','underline','strikethrough','horizontal','time','date'
,'fontfamily','fontsize','fontsize','simpleupload','insertimage','emotion','spechars','insertvideo'
,'justifyleft','justifyright','justifycenter','justifyjustify','forecolor']
]
}); //设计工具栏
</script>
数据库取值
就跟普通项一样,用request.getParameter(“content”);数据库类型用text