maven中整合ueditor步骤与常见问题(一)

整合ueditor步骤(这里使用的1.1.2版本的ueditor)

1.在jsp页面中引入相关的文件

<!-- 富文本编辑器引入文件 -->
<script type="text/javascript" src="../ueditor/ueditor.config.js"></script>  
<script type="text/javascript" src="../ueditor/ueditor.all.js"></script>  

2.下载ueditor,解压后将ueditor目录复制到自己项目路径下



3.创建编辑器实例及其DOM容器,先在jsp页面中添加一个<textarea>容器,再用脚本创建ueditor编辑器


<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ include file="/common/header.jsp" %>

<!-- 富文本编辑器引入文件 -->
<script type="text/javascript" src="../ueditor/ueditor.config.js"></script>  
<script type="text/javascript" src="../ueditor/ueditor.all.js"></script>  

<style>
body {
    background: #f0f4ff;
}
</style>

<body style="width:95%;height:100% ;overflow:auto">
    <div style="padding:10px 10px 20px 10px">
        <form id="actionform" method="post">
            <table cellpadding="5"  style="font-size: 14px">
                <tr>
                    <td>新闻内容:</td>
                    <td><textarea  name="news" id="news"></textarea></td>
                </tr>
            </table>
        </form>
     </div>
</body>

<script>
    //ueditor编辑器
    UE.getEditor('news');
</script>


<!-- 富文本编辑器引入文件 -->
<script type="text/javascript" src="../ueditor/ueditor.config.js"></script>  
<script type="text/javascript" src="../ueditor/ueditor.all.js"></script>  

<style>
body {
	background: #f0f4ff;
}
</style>

<body style="width:95%;height:100% ;overflow:auto">
	<div style="padding:10px 10px 20px 10px">
	    <form id="actionform" method="post">
	    	<table cellpadding="5"  style="font-size: 14px">
	    		<tr>
	    			<td>新闻内容:</td>
	    			<td><textarea  name="news" id="news"></textarea></td>
	    		</tr>
	    	</table>
	    </form>
	 </div>
</body>

<script>
	//ueditor编辑器
	UE.getEditor('news');
</script>
这里需要注意的是红色字体标示的部分,这么写可以解决ueditor工具栏被悬置在页面顶端无法下来的问题,如下图所示:



4.做到这里ueditor还没有配置完成,还需要在pom.xml中加载ueditor的依赖,先运行整合ueditor的页面,可看到后台报错如下:


现在在pom.xml中加载ueditor的依赖jar包:

		<!-- 添加Ueditor依赖 -->
		<dependency>
			<groupId>com.baidu</groupId>
			<artifactId>ueditor</artifactId>
			<version>1.1.2</version>
		</dependency>


5.到这里,ueditor基本配置完成,这里再介绍可能遇到的问题:

   后台报org.json.JSONObject找不到类的错误,只需要在pom.xml中添加其依赖即可


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

小胖墩有点瘦

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值