1.struts在2.1.3之前,fiter-class为
<
filter-class
>org.apache.struts2.dispatcher.FilterDispatcher</
filter-class
>
,
之后版本为<
filter-class
>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</
filter-class
>
2.strtus2的标签库文件在struts-core.jar中,tomcat容器会自动找到它,可以不用在web.xml中配置它的位置,如果要统一管理它的位置,可以在web.xml中这样配置
<
taglib
>
<
taglib-uri
>/s</
taglib-uri
> <!--这是jsp页面所要引用的虚拟路径-->
<
taglib-location
>/WEB-INF/struts-tags.tld</
taglib-location
> <!--tld文件的实际位置-->
<
taglib-uri
>/c</
taglib-uri
>
<
taglib-location
>/WEB-INF/c.tld</
taglib-location
>
<
taglib-uri
>/f</
taglib-uri
>
<
taglib-location
>/WEB-INF/functions.tld</
taglib-location
>
<
taglib-uri
>/c</
taglib-uri
>
<
taglib-location
>/WEB-INF/c.tld</
taglib-location
>
<
taglib-uri
>/f</
taglib-uri
>
<
taglib-location
>/WEB-INF/functions.tld</
taglib-location
>
</
taglib
>
3.ssh整合时,在web.xml配置spring文件位置.
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath*:applicationContext.xml,
/WEB-INF/customization/*.xml <!--加载不同模块下的spring bean的配置-->
</param-value>
</context-param>
<!--初始化spring容器-->
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
4.配置log4j日志
<context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>/WEB-INF/classes/log4j.properties</param-value> <!--注意,这里有classes,说明是编译后的文件路径-->
</context-param>
<listener>
<listener-class>
org.springframework.web.util.Log4jConfigListener
</listener-class>
</listener>
5.配置ajax框架dwr
<servlet>
<servlet-name>dwr-invoker</servlet-name>
<servlet-class>
org.directwebremoting.servlet.DwrServlet
</servlet-class>
<init-param>
<param-name>debug</param-name>
<param-value>true</param-value>
</init-param>
<!-- 设置日志级别 -->
<init-param>
<param-name>logLevel</param-name>
<param-value>WARN</param-value>
</init-param>
<!-- 如何允许跨哉请求,则设为false, 默认为true -->
<init-param>
<param-name>crossDomainSessionSecurity</param-name>
<param-value>false</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>dwr-invoker</servlet-name>
<url-pattern>/dwr/*</url-pattern>
</servlet-mapping>