struts2与fckeditor整合

我下载了一个配置好的web实例。

 

http://cdnetworks-kr-1.dl.sourceforge.net/project/fckeditor/FCKeditor.Java/2.6/fckeditor-java-demo-2.6.war


主要是lib,fckeditor文件夹和web.xml参考

1、lib中的jar包添加到自己项目的lib中,注意commons-fileupload-1.2.1.jar,commons-io-1.3.2.jar在struts2已经加入,所以就不用导入项目中的lib目录了。

 

2、fckeditor文件夹复制到自己的项目的WebRoot目录下。

 

3、配置文件;

web.xml(主要是给struts2访问增加限制)

 

 

<?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://java.sun.com/xml/ns/javaee   http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
	<servlet>
		<servlet-name>ConnectorServlet</servlet-name>
		<servlet-class>net.fckeditor.connector.ConnectorServlet</servlet-class>
		<load-on-startup>1</load-on-startup>
	</servlet>
	<servlet-mapping>
		<servlet-name>ConnectorServlet</servlet-name>
		<url-pattern>/fckeditor/editor/filemanager/connectors/*</url-pattern>
	</servlet-mapping>
	<!-- fckeditor配置完毕 -->

	<!--
		配置Spring上下文和监听器 上下文用于找到Spring配置文件applicationContext.xml,

		监听器用于当Web应用程序启动,即可监听Spring上下文
	-->
	<context-param>
		<param-name>contextConfigLocation</param-name>
		<param-value>/WEB-INF/applicationContext*.xml,classpath*:applicationContext*.xml</param-value>
	</context-param>
	<!-- 配置OpenSessionInView(用于关闭Session),Struts过滤器之前 -->
	<filter>
		<filter-name>lazyLoadingFilter</filter-name>
		<filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
	</filter>

	<filter>
		<filter-name>action2</filter-name>
		<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
	</filter>
	<filter-mapping>
		<filter-name>lazyLoadingFilter</filter-name>
		<!-- 注:Struts2为*.action -->
		<url-pattern>*.do</url-pattern>
	</filter-mapping>
	<!-- END SNIPPET: filter -->
	<filter-mapping>
		<filter-name>action2</filter-name>
		<url-pattern>*.do</url-pattern>
	</filter-mapping>
	<filter-mapping>
		<filter-name>action2</filter-name>
		<url-pattern>*.jsp</url-pattern>
	</filter-mapping>
	<listener>
		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
	</listener>
	<welcome-file-list>
		<welcome-file>index.jsp</welcome-file>
	</welcome-file-list>
	<error-page>
		<error-code>404</error-code>
		<location>/empty.html</location>
	</error-page>
	<login-config>
		<auth-method>BASIC</auth-method>
	</login-config>
</web-app>

 

还有struts.xml添加一个

 

 

<constant name="struts.action.extension" value="do"/>

你可能感兴趣的:(spring,Web,javaee,servlet,fckeditor)