java 富文本编辑器demo
富文本编辑器demo,java 实现,可把数据存入数据库,在jsp中修改数据库配置
代码片段和文件信息
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 608 2014-07-21 16:03 EditorMe.classpath
文件 297 2014-07-21 16:03 EditorMe.mymetadata
文件 1281 2014-07-21 16:15 EditorMe.project
文件 105 2014-07-21 16:15 EditorMe.settingscom.genuitec.eclipse.core.prefs
文件 88 2014-07-21 16:08 EditorMe.settingsorg.eclipse.core.resources.prefs
文件 83 2014-07-21 16:08 EditorMe.settingsorg.eclipse.core.runtime.prefs
文件 7377 2014-07-21 16:05 EditorMesrcueditorUploader.java
文件 1272 2014-07-21 16:24 EditorMeWebRootindex.jsp
文件 36 2014-07-21 16:03 EditorMeWebRootmeta-INFMANIFEST.MF
文件 3374 2014-07-21 17:05 EditorMeWebRootsave.jsp
文件 1627 2013-06-25 14:17 EditorMeWebRootueditordialogsanchoranchor.html
文件 2602 2013-06-25 14:17 EditorMeWebRootueditordialogsattachmentattachment.css
文件 6241 2013-06-25 14:17 EditorMeWebRootueditordialogsattachmentattachment.html
文件 6009 2013-06-25 14:17 EditorMeWebRootueditordialogsattachmentcallbacks.js
文件 923 2013-06-25 14:17 EditorMeWebRootueditordialogsattachmentfileTypeImagesicon_chm.gif
文件 841 2013-06-25 14:17 EditorMeWebRootueditordialogsattachmentfileTypeImagesicon_default.png
文件 1012 2013-06-25 14:17 EditorMeWebRootueditordialogsattachmentfileTypeImagesicon_doc.gif
文件 949 2013-06-25 14:17 EditorMeWebRootueditordialogsattachmentfileTypeImagesicon_exe.gif
文件 986 2013-06-25 14:17 EditorMeWebRootueditordialogsattachmentfileTypeImagesicon_mp3.gif
文件 1001 2013-06-25 14:17 EditorMeWebRootueditordialogsattachmentfileTypeImagesicon_mv.gif
文件 996 2013-06-25 14:17 EditorMeWebRootueditordialogsattachmentfileTypeImagesicon_pdf.gif
文件 1001 2013-06-25 14:17 EditorMeWebRootueditordialogsattachmentfileTypeImagesicon_ppt.gif
文件 1009 2013-06-25 14:17 EditorMeWebRootueditordialogsattachmentfileTypeImagesicon_psd.gif
文件 1007 2013-06-25 14:17 EditorMeWebRootueditordialogsattachmentfileTypeImagesicon_rar.gif
文件 970 2013-06-25 14:17 EditorMeWebRootueditordialogsattachmentfileTypeImagesicon_txt.gif
文件 1005 2013-06-25 14:17 EditorMeWebRootueditordialogsattachmentfileTypeImagesicon_xls.gif
文件 747 2013-06-25 14:17 EditorMeWebRootueditordialogsattachmentfileTypeMaps.js
文件 1102 2013-06-25 14:17 EditorMeWebRootueditordialogsackgroundackground.css
文件 2891 2013-06-25 14:17 EditorMeWebRootueditordialogsackgroundackground.html
文件 11945 2013-06-25 14:17 EditorMeWebRootueditordialogsackgroundackground.js
............此处省略227个文件信息
package ueditor;
import java.io.*;
import java.text.SimpleDateFormat;
import java.util.*;
import org.apache.commons.fileupload.*;
import org.apache.commons.fileupload.FileUploadbase.InvalidContentTypeException;
import org.apache.commons.fileupload.FileUploadbase.SizeLimitExceededException;
import org.apache.commons.fileupload.util.*;
import org.apache.commons.fileupload.servlet.*;
import org.apache.commons.fileupload.FileItemIterator;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import sun.misc.base64Decoder;
import javax.servlet.http.HttpServletRequest;
/**
* UEditor文件上传辅助类
*
*/
public class Uploader {
// 输出文件地址
private String url = ““;
// 上传文件名
private String fileName = ““;
// 状态
private String state = ““;
// 文件类型
private String type = ““;
// 原始文件名
private String originalName = ““;
// 文件大小
private String size = ““;
private HttpServletRequest request = null;
private String title = ““;
// 保存路径
private String savePath = “upload“;
// 文件允许格式
private String[] allowFiles = { “.rar“ “.doc“ “.docx“ “.zip“ “.pdf““.txt“ “.swf“ “.wmv“ “.gif“ “.png“ “.jpg“ “.jpeg“ “.bmp“ };
// 文件大小限制,单位KB
private int maxSize = 10000;
private HashMap errorInfo = new HashMap();
public Uploader(HttpServletRequest request) {
this.request = request;
HashMap tmp = this.errorInfo;
tmp.put(“SUCCESS“ “SUCCESS“); //默认成功
tmp.put(“NOFILE“ “未包含文件上传域“);
tmp.put(“TYPE“ “不允许的文件格式“);
tmp.put(“SIZE“ “文件大小超出限制“);
tmp.put(“ENTYPE“ “请求类型ENTYPE错误“);
tmp.put(“REQUEST“ “上传请求异常“);
tmp.put(“IO“ “IO异常“);
tmp.put(“DIR“ “目录创建失败“);
tmp.put(“UNKNOWN“ “未知错误“);
}
public void upload() throws Exception {
boolean isMultipart = ServletFileUpload.isMultipartContent(this.request);
if (!isMultipart) {
this.state = this.errorInfo.get(“NOFILE“);
return;
}
DiskFileItemFactory dff = new DiskFileItemFactory();
String savePath = this.getFolder(this.savePath);
dff.setRepository(new File(savePath));
try {
ServletFileUpload sfu = new ServletFileUpload(dff);
sfu.setSizeMax(this.maxSize * 1024);
sfu.setHeaderEncoding(“utf-8“);
FileItemIterator fii = sfu.getItemIterator(this.request);
while (fii.hasNext()) {
FileItemStream fis = fii.next();
if (!fis.isFormField()) {
this.originalName = fis.getName().substring(fis.getName().lastIndexOf(System.getProperty(“file.separator“)) + 1);
if (!this.checkFileType(this.originalName)) {
this.state = this.errorInfo.get(“TYPE“);
continue;
}
this.fileName = this.getName(this.originalName);
this.type = this.getFileExt(this.fileName);
this.url = savePath + “/“ + this.fileName;
BufferedInputStream in = new BufferedInputStream(fis.openStream());
FileOutputStream out = new FileOutputStream(new File(this.getPhysicalPath(this.url)));
BufferedOutputStream output = new Bu
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 608 2014-07-21 16:03 EditorMe.classpath
文件 297 2014-07-21 16:03 EditorMe.myme
文件 1281 2014-07-21 16:15 EditorMe.project
文件 105 2014-07-21 16:15 EditorMe.settingscom.genuitec.eclipse.core.prefs
文件 88 2014-07-21 16:08 EditorMe.settingsorg.eclipse.core.resources.prefs
文件 83 2014-07-21 16:08 EditorMe.settingsorg.eclipse.core.runtime.prefs
文件 7377 2014-07-21 16:05 EditorMesrcueditorUploader.java
文件 1272 2014-07-21 16:24 EditorMeWebRootindex.jsp
文件 36 2014-07-21 16:03 EditorMeWebRootme
文件 3374 2014-07-21 17:05 EditorMeWebRootsave.jsp
文件 1627 2013-06-25 14:17 EditorMeWebRootueditordialogsanchoranchor.html
文件 2602 2013-06-25 14:17 EditorMeWebRootueditordialogsattachmentattachment.css
文件 6241 2013-06-25 14:17 EditorMeWebRootueditordialogsattachmentattachment.html
文件 6009 2013-06-25 14:17 EditorMeWebRootueditordialogsattachmentcallbacks.js
文件 923 2013-06-25 14:17 EditorMeWebRootueditordialogsattachmentfileTypeImagesicon_chm.gif
文件 841 2013-06-25 14:17 EditorMeWebRootueditordialogsattachmentfileTypeImagesicon_default.png
文件 1012 2013-06-25 14:17 EditorMeWebRootueditordialogsattachmentfileTypeImagesicon_doc.gif
文件 949 2013-06-25 14:17 EditorMeWebRootueditordialogsattachmentfileTypeImagesicon_exe.gif
文件 986 2013-06-25 14:17 EditorMeWebRootueditordialogsattachmentfileTypeImagesicon_mp3.gif
文件 1001 2013-06-25 14:17 EditorMeWebRootueditordialogsattachmentfileTypeImagesicon_mv.gif
文件 996 2013-06-25 14:17 EditorMeWebRootueditordialogsattachmentfileTypeImagesicon_pdf.gif
文件 1001 2013-06-25 14:17 EditorMeWebRootueditordialogsattachmentfileTypeImagesicon_ppt.gif
文件 1009 2013-06-25 14:17 EditorMeWebRootueditordialogsattachmentfileTypeImagesicon_psd.gif
文件 1007 2013-06-25 14:17 EditorMeWebRootueditordialogsattachmentfileTypeImagesicon_rar.gif
文件 970 2013-06-25 14:17 EditorMeWebRootueditordialogsattachmentfileTypeImagesicon_txt.gif
文件 1005 2013-06-25 14:17 EditorMeWebRootueditordialogsattachmentfileTypeImagesicon_xls.gif
文件 747 2013-06-25 14:17 EditorMeWebRootueditordialogsattachmentfileTypeMaps.js
文件 1102 2013-06-25 14:17 EditorMeWebRootueditordialogsackgroundackground.css
文件 2891 2013-06-25 14:17 EditorMeWebRootueditordialogsackgroundackground.html
文件 11945 2013-06-25 14:17 EditorMeWebRootueditordialogsackgroundackground.js
............此处省略227个文件信息
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。
评论列表(条)