超强大的图文混排编辑器 Struts2+FCKeditor-2.3 下载即可部署使用,完整Demo,有不懂的可以留言。

本文主要是介绍超强大的图文混排编辑器 Struts2+FCKeditor-2.3 下载即可部署使用,完整Demo,有不懂的可以留言。,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

原文:超强大的图文混排编辑器 Struts2+FCKeditor-2.3 下载即可部署使用,完整Demo,有不懂的可以留言。

源代码下载:http://www.zuidaima.com/share/1550463380982784.htm

超强大的图文混排编辑器 Struts2+FCKeditor-2.3 下载即可部署使用,完整Demo,有不懂的可以留言。 1.文本编辑器分为:Basic,Default var editor = new FCKeditor("content","800","400","Default",""); 2.更换皮肤 找到/EditWebTest/WebRoot/fckeditor/fckconfig.js 找到45行的FCKConfig.SkinPath = FCKConfig.BasePath + 'skins/default/' ; 修改default单词即可,皮肤自带有三种,第一种为default,office2003,silver 超强大的图文混排编辑器 Struts2+FCKeditor-2.3 下载即可部署使用,完整Demo,有不懂的可以留言。

package com.zuidaima.edit.util;import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;import net.fckeditor.handlers.CommandHandler;
import net.fckeditor.handlers.ConnectorHandler;
import net.fckeditor.handlers.ExtensionsHandler;
import net.fckeditor.handlers.RequestCycleHandler;
import net.fckeditor.handlers.ResourceTypeHandler;
import net.fckeditor.response.UploadResponse;
import net.fckeditor.response.XmlResponse;
import net.fckeditor.tool.Utils;
import net.fckeditor.tool.UtilsFile;
import net.fckeditor.tool.UtilsResponse;import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.servlet.ServletFileUpload;
import org.apache.commons.io.FilenameUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*@author www.zuidaima.com
**/public class MyConnectorServlet extends HttpServlet {private static final long serialVersionUID = 0xb05049436ea5f077L;private static final Logger logger = LoggerFactory.getLogger(MyConnectorServlet.class);public MyConnectorServlet() {}public void init() throws ServletException, IllegalArgumentException {String s = getServletContext().getRealPath(ConnectorHandler.getDefaultUserFilesPath());File file = new File(s);UtilsFile.checkDirAndCreate(file);logger.info("MyConnectorServlet successfully initialized!");}public void doGet(HttpServletRequest httpservletrequest,HttpServletResponse httpservletresponse) throws ServletException,IOException {logger.debug("Entering MyConnectorServlet#doGet");httpservletresponse.setCharacterEncoding("UTF-8");httpservletresponse.setContentType("application/xml; charset=UTF-8");httpservletresponse.setHeader("Cache-Control", "no-cache");PrintWriter printwriter = httpservletresponse.getWriter();String s = httpservletrequest.getParameter("Command");String s1 = httpservletrequest.getParameter("Type");String s2 = httpservletrequest.getParameter("CurrentFolder");logger.debug("Parameter Command: {}", s);logger.debug("Parameter Type: {}", s1);logger.debug("Parameter CurrentFolder: {}", s2);XmlResponse xmlresponse;if (!RequestCycleHandler.isEnabledForFileBrowsing(httpservletrequest))xmlresponse = new XmlResponse(1,"The current user isn't authorized for file browsing!");else if (!CommandHandler.isValidForGet(s))xmlresponse = new XmlResponse(1, "Invalid command specified");else if (s1 != null && !ResourceTypeHandler.isValid(s1))xmlresponse = new XmlResponse(1, "Invalid resource type specified");else if (!UtilsFile.isValidPath(s2)) {xmlresponse = new XmlResponse(1, "Invalid current folder specified");} else {CommandHandler commandhandler = CommandHandler.getCommand(s);ResourceTypeHandler resourcetypehandler = ResourceTypeHandler.getDefaultResourceType(s1);String s3 = UtilsFile.constructServerSidePath(httpservletrequest,resourcetypehandler);// s3=s3+"/"+getDate(3);//浏览时浏览最顶层目录String s4 = getServletContext().getRealPath(s3);File file = new File(s4);UtilsFile.checkDirAndCreate(file);File file1 = new File(file, s2);if (!file1.exists()) {xmlresponse = new XmlResponse(102);} else {xmlresponse = new XmlResponse(commandhandler,resourcetypehandler, s2,UtilsResponse.constructResponseUrl(httpservletrequest,resourcetypehandler, s2, true,ConnectorHandler.isFullUrl()));if (commandhandler.equals(CommandHandler.GET_FOLDERS))xmlresponse.setFolders(file1);else if (commandhandler.equals(CommandHandler.GET_FOLDERS_AND_FILES))xmlresponse.setFoldersAndFiles(file1);else if (commandhandler.equals(CommandHandler.CREATE_FOLDER)) {String s5 = UtilsFile.sanitizeFolderName(httpservletrequest.getParameter("NewFolderName"));logger.debug("Parameter NewFolderName: {}", s5);File file2 = new File(file1, s5);byte byte0 = 110;if (file2.exists())byte0 = 101;elsetry {byte0 = ((byte) (file2.mkdir() ? 0 : 102));} catch (SecurityException securityexception) {byte0 = 103;}xmlresponse.setError(byte0);}}}printwriter.print(xmlresponse);printwriter.flush();printwriter.close();logger.debug("Exiting MyConnectorServlet#doGet");}@SuppressWarnings("unchecked")public void doPost(HttpServletRequest httpservletrequest,HttpServletResponse httpservletresponse) throws ServletException,IOException {logger.debug("Entering Connector#doPost");httpservletresponse.setCharacterEncoding("UTF-8");httpservletresponse.setContentType("text/html; charset=UTF-8");httpservletresponse.setHeader("Cache-Control", "no-cache");PrintWriter printwriter = httpservletresponse.getWriter();String s = httpservletrequest.getParameter("Command");String s1 = httpservletrequest.getParameter("Type");String s2 = httpservletrequest.getParameter("CurrentFolder");logger.debug("Parameter Command: {}", s);logger.debug("Parameter Type: {}", s1);logger.debug("Parameter CurrentFolder: {}", s2);if (Utils.isEmpty(s) && Utils.isEmpty(s2)) {s = "QuickUpload";s2 = "/";}UploadResponse uploadresponse;if (!RequestCycleHandler.isEnabledForFileUpload(httpservletrequest))uploadresponse = new UploadResponse(new Object[] {Integer.valueOf(203), null, null,"The current user isn't authorized for file upload!" });else if (!CommandHandler.isValidForPost(s))uploadresponse = new UploadResponse(new Object[] { Integer.valueOf(1), null, null,"Invalid command specified" });else if (s1 != null && !ResourceTypeHandler.isValid(s1))uploadresponse = new UploadResponse(new Object[] {Integer.valueOf(1), null, null,"Invalid resource type specified" });else if (!UtilsFile.isValidPath(s2)) {uploadresponse = UploadResponse.UR_INVALID_CURRENT_FOLDER;} else {ResourceTypeHandler resourcetypehandler = ResourceTypeHandler.getDefaultResourceType(s1);String s3 = UtilsFile.constructServerSidePath(httpservletrequest,resourcetypehandler);s3 = s3 + "/" + getDate(3);String s4 = getServletContext().getRealPath(s3);File file = new File(s4);UtilsFile.checkDirAndCreate(file);File file1 = new File(file, s2);if (!file1.exists()) {uploadresponse = UploadResponse.UR_INVALID_CURRENT_FOLDER;} else {String s5 = null;DiskFileItemFactory diskfileitemfactory = new DiskFileItemFactory();ServletFileUpload servletfileupload = new ServletFileUpload(diskfileitemfactory);servletfileupload.setHeaderEncoding("UTF-8");try {List list = servletfileupload.parseRequest(httpservletrequest);FileItem fileitem = (FileItem) list.get(0);String s6 = UtilsFile.sanitizeFileName(fileitem.getName());String s7 = FilenameUtils.getName(s6);String s8 = getDate(0);String s9 = FilenameUtils.getExtension(s7);s7 = s8.concat(".").concat(s9.toLowerCase());if (!ExtensionsHandler.isAllowed(resourcetypehandler, s9)) {uploadresponse = new UploadResponse(new Object[] { Integer.valueOf(202) });} else {File file2 = new File(file1, s7);for (int i = 1; file2.exists(); i++) {s5 = s8.concat("_").concat(String.valueOf(i)).concat(".").concat(s9.toLowerCase());file2 = new File(file1, s5);}if (Utils.isEmpty(s5)) {s2 = s2 + getDate(3) + "/";uploadresponse = new UploadResponse(new Object[] {Integer.valueOf(0),UtilsResponse.constructResponseUrl(httpservletrequest,resourcetypehandler, s2, true,ConnectorHandler.isFullUrl()).concat(s7) });String aa = UtilsResponse.constructResponseUrl(httpservletrequest, resourcetypehandler,s2, true, ConnectorHandler.isFullUrl()).concat(s7);} else {uploadresponse = new UploadResponse(new Object[] {Integer.valueOf(201),UtilsResponse.constructResponseUrl(httpservletrequest,resourcetypehandler, s2, true,ConnectorHandler.isFullUrl()).concat(s5), s5 });}if (resourcetypehandler.equals(ResourceTypeHandler.IMAGE)&& ConnectorHandler.isSecureImageUploads()) {if (UtilsFile.isImage(fileitem.getInputStream())) {fileitem.write(file2);} else {fileitem.delete();uploadresponse = new UploadResponse(new Object[] { Integer.valueOf(202) });}} else {fileitem.write(file2);}}} catch (Exception exception) {uploadresponse = new UploadResponse(new Object[] { Integer.valueOf(203) });}}}printwriter.print(uploadresponse);printwriter.flush();printwriter.close();logger.debug("Exiting Connector#doPost");}public static final String getDate(int i) {String as[] = { "yyyyMMddHHmmssSSS", "yyyyMMddHHmmss", "yyMMddHHmmss","yyyyMMdd", "yyyy-MM-dd", "HHmmssSSS", "HHmmss" };SimpleDateFormat simpledateformat = null;try {simpledateformat = new SimpleDateFormat(as[i]);} catch (Exception exception) {exception.printStackTrace();System.out.print(exception.toString());return exception.toString();}return simpledateformat.format(new Date());}}

 

这篇关于超强大的图文混排编辑器 Struts2+FCKeditor-2.3 下载即可部署使用,完整Demo,有不懂的可以留言。的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/648401

相关文章

闲置电脑也能活出第二春?鲁大师AiNAS让你动动手指就能轻松部署

对于大多数人而言,在这个“数据爆炸”的时代或多或少都遇到过存储告急的情况,这使得“存储焦虑”不再是个别现象,而将会是随着软件的不断臃肿而越来越普遍的情况。从不少手机厂商都开始将存储上限提升至1TB可以见得,我们似乎正处在互联网信息飞速增长的阶段,对于存储的需求也将会不断扩大。对于苹果用户而言,这一问题愈发严峻,毕竟512GB和1TB版本的iPhone可不是人人都消费得起的,因此成熟的外置存储方案开

大模型研发全揭秘:客服工单数据标注的完整攻略

在人工智能(AI)领域,数据标注是模型训练过程中至关重要的一步。无论你是新手还是有经验的从业者,掌握数据标注的技术细节和常见问题的解决方案都能为你的AI项目增添不少价值。在电信运营商的客服系统中,工单数据是客户问题和解决方案的重要记录。通过对这些工单数据进行有效标注,不仅能够帮助提升客服自动化系统的智能化水平,还能优化客户服务流程,提高客户满意度。本文将详细介绍如何在电信运营商客服工单的背景下进行

中文分词jieba库的使用与实景应用(一)

知识星球:https://articles.zsxq.com/id_fxvgc803qmr2.html 目录 一.定义: 精确模式(默认模式): 全模式: 搜索引擎模式: paddle 模式(基于深度学习的分词模式): 二 自定义词典 三.文本解析   调整词出现的频率 四. 关键词提取 A. 基于TF-IDF算法的关键词提取 B. 基于TextRank算法的关键词提取

使用SecondaryNameNode恢复NameNode的数据

1)需求: NameNode进程挂了并且存储的数据也丢失了,如何恢复NameNode 此种方式恢复的数据可能存在小部分数据的丢失。 2)故障模拟 (1)kill -9 NameNode进程 [lytfly@hadoop102 current]$ kill -9 19886 (2)删除NameNode存储的数据(/opt/module/hadoop-3.1.4/data/tmp/dfs/na

Hadoop数据压缩使用介绍

一、压缩原则 (1)运算密集型的Job,少用压缩 (2)IO密集型的Job,多用压缩 二、压缩算法比较 三、压缩位置选择 四、压缩参数配置 1)为了支持多种压缩/解压缩算法,Hadoop引入了编码/解码器 2)要在Hadoop中启用压缩,可以配置如下参数

Makefile简明使用教程

文章目录 规则makefile文件的基本语法:加在命令前的特殊符号:.PHONY伪目标: Makefilev1 直观写法v2 加上中间过程v3 伪目标v4 变量 make 选项-f-n-C Make 是一种流行的构建工具,常用于将源代码转换成可执行文件或者其他形式的输出文件(如库文件、文档等)。Make 可以自动化地执行编译、链接等一系列操作。 规则 makefile文件

使用opencv优化图片(画面变清晰)

文章目录 需求影响照片清晰度的因素 实现降噪测试代码 锐化空间锐化Unsharp Masking频率域锐化对比测试 对比度增强常用算法对比测试 需求 对图像进行优化,使其看起来更清晰,同时保持尺寸不变,通常涉及到图像处理技术如锐化、降噪、对比度增强等 影响照片清晰度的因素 影响照片清晰度的因素有很多,主要可以从以下几个方面来分析 1. 拍摄设备 相机传感器:相机传

阿里开源语音识别SenseVoiceWindows环境部署

SenseVoice介绍 SenseVoice 专注于高精度多语言语音识别、情感辨识和音频事件检测多语言识别: 采用超过 40 万小时数据训练,支持超过 50 种语言,识别效果上优于 Whisper 模型。富文本识别:具备优秀的情感识别,能够在测试数据上达到和超过目前最佳情感识别模型的效果。支持声音事件检测能力,支持音乐、掌声、笑声、哭声、咳嗽、喷嚏等多种常见人机交互事件进行检测。高效推

常用的jdk下载地址

jdk下载地址 安装方式可以看之前的博客: mac安装jdk oracle 版本:https://www.oracle.com/java/technologies/downloads/ Eclipse Temurin版本:https://adoptium.net/zh-CN/temurin/releases/ 阿里版本: github:https://github.com/

pdfmake生成pdf的使用

实际项目中有时会有根据填写的表单数据或者其他格式的数据,将数据自动填充到pdf文件中根据固定模板生成pdf文件的需求 文章目录 利用pdfmake生成pdf文件1.下载安装pdfmake第三方包2.封装生成pdf文件的共用配置3.生成pdf文件的文件模板内容4.调用方法生成pdf 利用pdfmake生成pdf文件 1.下载安装pdfmake第三方包 npm i pdfma