①导入js文件
<script type="text/javascript" charset="utf-8" src="<%=contextPath%>/ueditor/ueditor.config.js">
</script>
<script type="text/javascript" charset="utf-8" src="<%=contextPath%>/ueditor/ueditor.all.js">
</script>
<script type="text/javascript" charset="utf-8" src="<%=contextPath%>/ueditor/lang/zh-cn/zh-cn.js">
</script>
②JSP页面嵌入
<body>
<script id="container" name="content" type="text/plain"></script>
</body>
③js调用
var tempFolder='${tempFolder}';
var ue ;
$(document).ready(function(){
window.UEDITOR_CONFIG.initialFrameWidth=1150;
window.UEDITOR_CONFIG.initialFrameHeight=300;
ue = UE.getEditor('container');
})
④保存页面获得内容(点击保存按钮)
var activityDesc= ue.getContent();//获得页面html,存入数据库
⑤修改页面,默认显示参数
ue.ready(function() {
//设置编辑器的内容
ue.setContent(data.activityDesc);
})
⑥预览页面,参数设置
window.top['previewContent']=previewContent;//点击预览按钮页面
//预览jsp页面
<div id="previewContent"></div>
<script type="text/javascript" >
$(function(){
$("#previewContent").html(window.top['previewContent']);
})
</script>