首页
诗词
字典
板报
句子
名言
友答
励志
学校
网站地图
Web前端
Dreamweaver
Fireworks
Flash
ASP
asp.net
PHP
JSP
SEO优化
源码建站
CSS
Web开发
Web前端
JavaScript
vbScript
Ajax
网页设计
跨浏览器开发
高性能WEB开发
Web Service
XML SOAP
当前位置:
首页
>
教程频道
>
网站开发
>
Web前端
>
SSH下整合CKEditor+CKFinder有关问题
2013-08-04
SSH下整合CKEditor+CKFinder问题转自:http://hunanpengdake.iteye.com/blog/1633814SSH下整合CKEditor+CKF
SSH下整合CKEditor+CKFinder问题
转自:http://hunanpengdake.iteye.com/blog/1633814
SSH下整合CKEditor+CKFinder问题
博客分类:
?常用后台框架Js代码??
CKEDITOR.editorConfig?=?function(?config?)??
??
{??
??
//?Define?changes?to?default?configuration?here.?For?example:??
??
//?config.language?=?'fr';??
??
//?config.uiColor?=?'#AADC6E';??
??
config.language?=??"zh-cn"?;???
??
config.filebrowserWindowWidth?=?'1000';????
??
????config.filebrowserWindowHeight?=?'700';???
??
??????
??
config.filebrowserBrowseUrl?=??'/sshWeb/ckfinder/ckfinder.html'?;????
??
????config.filebrowserImageBrowseUrl?=??'/sshWeb/ckfinder/ckfinder.html?type=Images'?;????
??
????config.filebrowserFlashBrowseUrl?=??'/sshWeb/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'?;???????
??
};??
参考文章:?
http://www.cnblogs.com/yezhenhan/archive/2011/12/10/2282986.html?
----------------------------------------------------------------?
5,Js写法的页面代码:?
Html代码??
<script?src="../../ckeditor/ckeditor.js"?type="text/javascript"></script>??
??
<script?src="../../ckfinder/ckfinder.js"?type="text/javascript"></script>??
??
<script?src="../js/jquery-1.7.2.js"?type="text/javascript"></script>????
??
<script?src="../../ckeditor/adapters/jquery.js"?type="text/javascript"></script>???
??
<s:form?action="about_add">??
??
?????<s:textfield?name="aboutUs.title"?label="标题"/>??
??
??????<s:textarea?name="aboutUs.content"?rows="30"?cols="50"?label="内容"/>??
??
??????<script?type="text/javascript">????
??
?????????????????$('#editor').ckeditor();????
??
?????????????????var?editor?=?CKEDITOR.replace('aboutUs.content');??
??
?????????????????CKFinder.setupCKEditor(editor,?'/sshWeb/ckfinder/');??
??
????????????</script>??
??
?????<s:submit/>??
??
</s:form>??
6,Web.xml配置:?
---struts2与servlet并存解决方法:使用自定义过滤器,将web.xml中添加的ckfinder的servlet过滤内容从struts2过滤中排除;?
Xml代码??
<filter>????
??
????????<filter-name>MyServlet</filter-name>????
??
???????<filter-class>util.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>????
??
????????
??
???????<filter>??
??
????????<filter-name>struts2</filter-name>??
??
????????<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</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>????
??
??????
??
??????
??
????<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>??
??
????<welcome-file-list>??
??
????????<welcome-file>index.html</welcome-file>??
??
</welcome-file-list>??
7,自定义过滤器:?
Java代码??
import?java.io.IOException;??
??
import?java.util.ArrayList;??
??
import?java.util.Arrays;??
??
import?javax.servlet.Filter;??
??
import?javax.servlet.FilterChain;??
??
import?javax.servlet.FilterConfig;??
??
import?javax.servlet.RequestDispatcher;??
??
import?javax.servlet.ServletException;??
??
import?javax.servlet.ServletRequest;??
??
import?javax.servlet.ServletResponse;??
??
import?javax.servlet.http.HttpServletRequest;??
??
public?class?ReDispatcherFilter?implements?Filter?{??
??
public?void?destroy()?{??
??
???//?TODO?Auto-generated?method?stub??
??
}??
??
public?void?doFilter(ServletRequest?req,?ServletResponse?resp,??
??
????FilterChain?chain)?throws?IOException,?ServletException???
??
{??
??
????
??
???HttpServletRequest?request?=?(HttpServletRequest)req;??
??
???String?target?=?request.getRequestURI();??
??
???target?=?target.lastIndexOf("?")>0?????
??
???????target.substring(target.lastIndexOf("/")+1,target.lastIndexOf("?")-target.lastIndexOf("/"))??
??
??????:target.substring(target.lastIndexOf("/")+1);??
??
????
??
???System.out.println(target);??
??
???if(this.includes.contains(target))??
??
???{??
??
????RequestDispatcher?rdsp?=?request.getRequestDispatcher(target);??
??
?????
??
????System.out.println("go..............."+rdsp);??
??
????rdsp.forward(req,?resp);??
??
???}??
??
???else??
??
????chain.doFilter(req,?resp);??
??
}??
??
private?ArrayList<String>?includes?=?new?ArrayList<String>();??
??
public?void?init(FilterConfig?config)?throws?ServletException?{??
??
????
??
???this.includes.addAll(?Arrays.asList(config.getInitParameter("includeServlets").split(",")));??
??
}??
??
}??
参考文章:?
ssh&ckfinder&ckeditor struts2与servlet并存解决方法?
http://blog.csdn.net/databaseyan/article/details/6914654?
http://hi.baidu.com/xsl2007/blog/item/4eb796cf94e35f0992457e11.html?
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////?
其它问题:?
上传文件中文名问题;?
上传文件位置问题;?
单纯Ckeditor的使用:?
下载最新的ckeditor文件: http://ckeditor.com/download?
解压后复制到web层根目录下;?
页面引用js:?
Html代码??
<script?src="ckeditor/ckeditor.js"?type="text/javascript"></script>??
替换TEXTAREA标签:?
Html代码??
<textarea?rows="30"?cols="50"?name="editor01">请输入.</textarea>??
<script?type="text/javascript">CKEDITOR.replace('editor01');</script>??
查看更多
下一篇
本文网址:
https://www.reader8.com/jiaocheng/20130804/1358043.html
读书人精选
热点排行
jquery的after与insertAfter的差异
牛角尖啊牛角尖
weblogic 认证回绝 Authentication for
菜鸟阅读Servlet源码值得注意的地方
[转]Remote Debugging with Eclipse + W
(四)事件处理——(6)给.ready()回调
(四)事件处理——(8)一个简单的风格
ext gridpanel 增删节查例子
元素正中的几种方法
判断iframe是不是加载完毕的方法(兼容i