UEditor用法

it2025-08-16  6

UEditor百度是咋回事。界面美观。强大,用起来还不错。

看到此链接http://ueditor.baidu.com/

一、下载

http://ueditor.baidu.com/download.html

二、部署

眼下最新版本号为1.1.7.3

下载下来的文件名称为ueditor1.1.7.3.zip

把解压出来的ueditor目录整个拷贝到项目WebRoot下

1.页面<head>里添加下面代码

<script type="text/javascript" charset="utf-8" src="ueditor/editor_config.js"></script> <script type="text/javascript" charset="utf-8" src="ueditor/editor_all.js"></script> <link rel="stylesheet" type="text/css" href="ueditor/themes/default/ueditor.css"/>2.页面<body>里添加下面代码 <div id="newscontent"></div> <script type="text/javascript"> var editor = new baidu.editor.ui.Editor(); editor.render('newscontent'); </script>打开浏览器。输入对应地址。一个美丽的编辑器就出现了,但表情和上传文件这块还须要更改一下配置

三、改动配置。添加上传

打开editor_config.js文件,改动URL的值

var URL= "ueditor/";保存,刷新一下页面。表情是不是能够出来了?

文件上传默认用的是ueditor/server/upload/php/up.php进行上传的,假设用jsp上传,须要改动两个地方

1.改动ueditor/dialogs/image/image.html页面里第304行和ueditor/dialogs/wordimage/wordimage.html页面第82行,改为使用up.jsp进行上传。这里面用的是apache的fileupload组件,所以要导入apache commons组件中的fileupload和io这两个jar包

url:'../../server/upload/jsp/up.jsp',

2.改动ueditor/server/jsp/up.jsp。指定文件的保存路径

//保存文件路径 String filePath = "uploadfiles"; String realPath = "D:\\apache-tomcat-6.0.26\\webapps\\test\\"+filePath;所以一切OK该,刷新测试!

转载于:https://www.cnblogs.com/bhlsheji/p/4565931.html

相关资源:数据结构—成绩单生成器
最新回复(0)