1. Datatables——jquery表格插件,可对表格进行排序、搜索、分页
官网:http://www.datatables.net/
使用介绍:http://410921124-qq-com.iteye.com/blog/1219420
2. CKEditor——HTML编辑器,所见即所得
官网:http://ckeditor.com/
3. CKFinder——Web浏览器的Ajax文件管理器
官网:http://ckfinder.com/
(1)因为CKEditor里有分页符,所以可以使用CKEditor+Datatables实现文字分页
利用CKEditor里的分页符源码:
<p>
</p>
<div style="page-break-after: always;">
<span style="display: none;"> </span></div>
<p>
</p>
在后台获取提交的页面源代码,通过split根据分页符对文字进行切割
//分页标志,注意回车换行符
String pageTag = "<div style=\"page-break-after: always;\">\r\n" +
"\t<span style=\"display: none;\"> </span></div>\r\n";
//根据分页标志对内容进行划分
public List<String> page(String detail){
if(detail != null){
String temp[] = detail.split(pageTag);
dList = Arrays.asList(temp);
return dList;
}
return null;
}
(2)CKEditor + CKFinder可以实现上传下载功能。
4. formvalidator——验证表单
官网:(http://www.cnblogs.com/wzmaodong/archive/2008/01/11/1034901.html,http://www.yhuan.com/forum.php)
5. CKEditor + CKFinder + SSH整合
转自:http://guoliang0-0-yahoo-cn.iteye.com/blog/1195348
一.需要的资源:
用到的网站,文件自己下载:
a) ckeditor_3.6.2 (解压)
download.cksource.com/CKEditor/CKEditor/CKEditor%203.6.2/ckeditor_3.6.2.zip
b) ckeditor-java-3.6.2 (解压)
download.cksource.com/CKEditor/CKEditor%20for%20Java/CKEditor%20for%20Java%203.6.2/ckeditor-java-3.6.2.war
c) ckfinder_java_2.1 (解压)
download.cksource.com/CKFinder/CKFinder%20for%20Java/2.1/ckfinder_java_2.1.zip
二. 执行步骤:
1. MyEclipse新建 Web Project : CKEditor_Finder
2. 复制以下文件夹到WebRoot 下面:
ckfinder_java_2.1\ckfinder\ CKFinderJava \ckfinder
注意:CKFinder 加粗的是 war 包解压后的文件夹的名称
ckeditor_3.6.2/ckeditor
3. 复制 CKFinder配置文件 到WEB-INF 下面:
ckfinder_java_2.1\ckfinder\CKFinderJava\WEB-INF\config.xml
4. 复制下面文件夹下面所有jar 文件到 WEB-INf/lib 下面:
ckfinder_java_2.1\ckfinder\CKFinderJava\WEB-INF\lib
ckeditor-java-3.6.2\WEB-INF\lib
三. 下面删除无用的文件
首先是ckeditor 下面的文件:
_sample,_source, CHANGES.html, ckeditor_php4.php , ckeditor_php5.php,
ckeditor.asp, ckeditor.pack, INSTALL.html, LICENSE.html
然后是ckfinder 下面的文件:
_samples, help, changelog.txt, install.txt, license.txt, translation.txt
四. 修改配置文件config.xml
- < enabled > true </ enabled >
- < baseURL > /CKEditor_Finder/userfiles/ </ baseURL >
五. 在web.xml 中增加如下代码:
- < servlet >
- < servlet-name > ConnectorServlet </ servlet-name >
- < servlet-class > com.ckfinder.connector.ConnectorServlet </ servlet-class >
- < init-param >
- < param-name > XMLConfig </ param-name >
- < param-value > /WEB-INF/config.xml </ param-value >
- </ init-param >
- < init-param >
- < param-name > debug </ param-name >
- < param-value > false </ param-value >
- </ init-param >
- < load-on-startup > 1 </ load-on-startup >
- </ servlet >
- < servlet-mapping >
- < servlet-name > ConnectorServlet </ servlet-name >
- < url-pattern > /ckfinder/core/connector/java/connector.java </ url-pattern >
- </ servlet-mapping >
- < filter >
- < filter-name > FileUploadFilter </ filter-name >
- < filter-class > com.ckfinder.connector.FileUploadFilter </ filter-class >
- < init-param >
- < param-name > sessionCookieName </ param-name >
- < param-value > JSESSIONID </ param-value >
- </ init-param >
- < init-param >
- < param-name > sessionParameterName </ param-name >
- < param-value > jsessionid </ param-value >
- </ init-param >
- </ filter >
- < filter-mapping >
- < filter-name > FileUploadFilter </ filter-name >
- < url-pattern > /ckfinder/core/connector/java/connector.java </ url-pattern >
- </ filter-mapping >
- < session-config >
- < session-timeout > 10 </ session-timeout >
- </ session-config >
六. 修改ckeditor/config.js文件的内容
- CKEDITOR.editorConfig = function (config) {
- config.filebrowserBrowseUrl = '/CKEditor_Finder/ckfinder/ckfinder.html' ;
- config.filebrowserImageBrowseUrl = '/CKEditor_Finder/ckfinder/ckfinder.html?type=Images' ;
- config.filebrowserFlashBrowseUrl = '/CKEditor_Finder/ckfinder/ckfinder.html?type=Flash' ;
- config.filebrowserUploadUrl = '/ckfinder/core/connector/java/connector.java?command=QuickUpload&type=Files' ;
- config.filebrowserImageUploadUrl = '/ckfinder/core/connector/java/connector.java?command=QuickUpload&type=Images' ;
- config.filebrowserFlashUploadUrl = '/ckfinder/core/connector/java/connector.java?command=QuickUpload&type=Flash' ;
- config.filebrowserWindowWidth = '1000' ;
- config.filebrowserWindowHeight = '700' ;
- config.language = "zh-cn" ;
- };
七. 修改index.jsp文件的内容如下:
- <%@ page language = "java" import = "java.util.*" pageEncoding = "utf-8" %>
- <%@ taglib uri = "http://ckfinder.com" prefix = "ckfinder" %>
- <%@ taglib uri = "http://ckeditor.com" prefix = "ckeditor" %>
- <%
- String path = request.getContextPath();
- String basePath = request.getScheme()+ "://" +request.getServerName()+ ":" +request.getServerPort()+path+ "/" ;
- %>
- <! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" >
- < html >
- < head >
- < base href = " <%= basePath %> " >
- < title > 首页 </ title >
- < meta http-equiv = "pragma" content = "no-cache" >
- < meta http-equiv = "cache-control" content = "no-cache" >
- < meta http-equiv = "expires" content = "0" >
- </ head >
- < body >
- < form action = "getContent" method = "get" >
- < textarea cols = "80" id = "editor1" name = "editor1" rows = "10" ></ textarea >
- < input type = "submit" value = "Submit" />
- </ form >
- < ckfinder:setupCKEditor basePath = "/CKEditor_Finder/ckfinder/" editor = "editor1" />
- < ckeditor:replace replace = "editor1" basePath = "/CKEditor_Finder/ckeditor/" />
- </ body >
- </ html >
http://localhost/CKEditor_Finder/
很可能或者可以说是肯定:您在访问之后操作的时候,不会像在我视频里面的那样顺利,尤其是关于中文问题,其中有一个重要的操作上面没有提及:
这个操作就是:找到Tomcat/config/server.xml
<Connector port="80" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" URIEncoding="utf-8" />
这个设置中的URIEncoding 是为了在访问的时候,即使访问路径中出现中文也能正常访问. 如果还有其他问题,可以发贴继续交流一下^_^
关于破解:
替换预览图片方框的文字为:预览图片的位置。
要替换的文件的位置:/CKEditor_Finder/WebRoot/ckeditor/plugins/image/dialogs/image.js
Ckfinder.js 文件的修改:
1. CKEditer/config.js文件大括号最后添加:
config.image_previewText = "预览图片的位置! 自己修改!! ";
(以下修改的文件均为:ckfinder/ckfinder.js文件)
2. return a.bF.length > 0 && A.indexOf(a.bF.substr(0, 9)) != -1 改为return false;
3.注释这一部分,这样,在上传一中图片之后,中间就不会有提示了
4. 注释掉这个部分:这样,左下角的东西就看不见了
6. ssh&ckfinder&ckeditor struts2与servlet并存解决方法
转自:http://blog.csdn.net/databaseyan/article/details/6914654
参考:http://hi.baidu.com/xsl2007/blog/item/4eb796cf94e35f0992457e11.html
http://hi.baidu.com/waterpub/blog/item/9cb89ec936771300be09e6a2.html
相信有很多人遇到过struts2与 servlet并存的问题,近日在整合ckeditor与ckfinder的过程中就遇到了这个问题,ckfinder与ckfinder整合成功,但移 入ssh框架中就出现了问题,在网上看了很多前辈的帖子,终于发现了问题所在,就是web.xml文件配置问题。经历过程如下:
通过参考这篇文章http://www.cppblog.com/fenglin/articles/147374.html
1.修改web.xml文件
将
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
换成
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>*.action</url-pattern>
</filter-mapping>
这样的确是可以使用自己定义的servlet了,但是,过了不久,又出了问题,如果使用struts2标签,该jsp页面显示不出来,报错,有人说添加
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>
这样jsp页面显示成功,但是我用的datetimepicker还是显示不出来 ,这让我相当纠结。最终还是要解决 struts2与servlet并存问题
2.
struts2与servlet并存问题,参考 http://hi.baidu.com/xsl2007/blog/item/4eb796cf94e35f0992457e11.html
问题解决,即定义一个过滤器,将servlet过滤,使struts2的核心控制器对servlet
下面是我的web.xml文件配置,ReDispatcherFilter类不变
- <?xml version= "1.0" encoding= "UTF-8" ?>
- <web-app version="2.5"
- xmlns="http://java.sun.com/xml/ns/javaee"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http:
- http:
-
- <welcome-file-list>
- <welcome-file>index.jsp</welcome-file>
- </welcome-file-list>
-
- <filter>
- <filter-name>MyServlet</filter-name>
- <filter-class >com.manager.action.ReDispatcherFilter</filter- class >
- <init-param>
- <param-name>includeServlets</param-name>
- <param-value>connector.java</param-value>
- </init-param>
- </filter>
- <filter-mapping>
- <filter-name>MyServlet</filter-name>
- <url-pattern>/*</url-pattern>
- </filter-mapping>
-
- <!-- struts2 -->
-
- <filter>
- <filter-name>struts2</filter-name>
- <filter-class >
- org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
- </filter-class >
- </filter>
- <filter-mapping>
- <filter-name>struts2</filter-name>
- <url-pattern>*.action</url-pattern>
- </filter-mapping>
- <filter-mapping>
- <filter-name>struts2</filter-name>
- <url-pattern>/*</url-pattern>
- </filter-mapping>
-
- <!-- ckfinder -->
- <servlet>
- <servlet-name>ConnectorServlet</servlet-name>
- <servlet-class >com.ckfinder.connector.ConnectorServlet</servlet- class >
- <init-param>
- <param-name>XMLConfig</param-name>
- <param-value>/WEB-INF/config.xml</param-value>
- </init-param>
- <init-param>
- <param-name>debug</param-name>
- <param-value>false </param-value>
- </init-param>
- <load-on-startup>1 </load-on-startup>
- </servlet>
- <servlet-mapping>
- <servlet-name>ConnectorServlet</servlet-name>
- <url-pattern>
- /ckfinder/core/connector/java/connector.java
- </url-pattern>
- </servlet-mapping>
- <session-config>
- <session-timeout>10 </session-timeout>
- </session-config>
- <!--ckeditor -->
- <servlet>
- <description>This is the description of my J2EE component</description>
- <display-name>This is the display name of my J2EE component</display-name>
- <servlet-name>Editor</servlet-name>
- <servlet-class >com.ckeditor.Editor</servlet- class >
- </servlet>
- <servlet-mapping>
- <servlet-name>Editor</servlet-name>
- <url-pattern>/servlet/Editor</url-pattern>
- </servlet-mapping>
-
- <!-- spring -->
- <listener>
- <listener-class >org.springframework.web.context.ContextLoaderListener</listener- class >
- </listener>
-
- </web-app>