Struts2强大,但也有很多需要解决的问题。就拿我现在这Blog这个FCKEditor来说吧,解决Struts2或Webwork的方案一直没有终止过。我试图修改FCKEditor Java版本的源代码,想改成 extends ActionSuppot, 但发现就算实现了,也代价非常大(可能FCKEdtitor的配置不能按官方来了),最后弄来弄个,选了个折中的办法。Struts2使用不了FCKEditor的原因是因为Struts2的Filter,如果修改一下Struts2在Web.xml里的注册。
Web.xml代码:
1 <?xml version="1.0" encoding="UTF-8"?>
2 <web-app xmlns="http://java.sun.com/xml/ns/javaee"
3 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.5"
4 xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
5 <servlet>
6 <servlet-name>Connector</servlet-name>
7 <servlet-class>
8 net.fckeditor.connector.ConnectorServlet
9 </servlet-class>
10 <load-on-startup>1</load-on-startup>
11 </servlet>
12 <servlet-mapping>
13 <servlet-name>Connector</servlet-name>
14 <url-pattern>
15 /fckeditor/editor/filemanager/connectors/*
16 </url-pattern>
17 </servlet-mapping>
18 <filter>
19 <filter-name>struts2</filter-name>
20 <filter-class>
21 org.apache.struts2.dispatcher.FilterDispatcher
22 </filter-class>
23 </filter>
24 <filter-mapping>
25 <filter-name>struts2</filter-name>
26 <url-pattern>*.action</url-pattern>
27 </filter-mapping>
28 <filter-mapping>
29 <filter-name>struts2</filter-name>
30 <url-pattern>*.jsp</url-pattern>
31 </filter-mapping>
32 <listener>
33 <listener-class>
34 org.springframework.web.context.ContextLoaderListener
35 </listener-class>
36 </listener>
37 <welcome-file-list>
38 <welcome-file>index.jsp</welcome-file>
39 </welcome-file-list>
40 </web-app>
41