关于JSP配置文件web.xml加载顺序详解(5)


 <servlet>
     <servlet-name>dwr-invoker</servlet-name>
     <servlet-class>uk.ltd.getahead.dwr.DWRServlet</servlet-class>
 </servlet>
 <servlet-mapping>
     <servlet-name>dwr-invoker</servlet-name>
     <url-pattern>/dwr/*</url-pattern>
 </servlet-mapping>


22、配置Struts

复制代码 代码如下:


 <display-name>Struts Blank Application</display-name>
 <servlet>
     <servlet-name>action</servlet-name>
     <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
     <init-param>
         <param-name>detail</param-name>
         <param-value>2</param-value>
     </init-param>
     <init-param>
         <param-name>debug</param-name>
         <param-value>2</param-value>
     </init-param>
     <init-param>
         <param-name>config</param-name>
         <param-value>/WEB-INF/struts-config.xml</param-value>
     </init-param>
     <init-param>
         <param-name>application</param-name>
         <param-value>ApplicationResources</param-value>
     </init-param>
     <load-on-startup>2</load-on-startup>
 </servlet>
 <servlet-mapping>
     <servlet-name>action</servlet-name>
     <url-pattern>*.do</url-pattern>
 </servlet-mapping>
 <welcome-file-list>
     <welcome-file>index.jsp</welcome-file>
 </welcome-file-list>

 <!-- Struts Tag Library Descriptors -->
 <taglib>
     <taglib-uri>struts-bean</taglib-uri>
     <taglib-location>/WEB-INF/tld/struts-bean.tld</taglib-location>
 </taglib>
 <taglib>
     <taglib-uri>struts-html</taglib-uri>
     <taglib-location>/WEB-INF/tld/struts-html.tld</taglib-location>
 </taglib>
 <taglib>
     <taglib-uri>struts-nested</taglib-uri>
     <taglib-location>/WEB-INF/tld/struts-nested.tld</taglib-location>
 </taglib>
 <taglib>
     <taglib-uri>struts-logic</taglib-uri>
     <taglib-location>/WEB-INF/tld/struts-logic.tld</taglib-location>
 </taglib>
 <taglib>
     <taglib-uri>struts-tiles</taglib-uri>
     <taglib-location>/WEB-INF/tld/struts-tiles.tld</taglib-location>
 </taglib>


23、配置Spring(基本上都是在Struts中配置的)

复制代码 代码如下:


 <!-- 指定spring配置文件位置 -->
 <context-param>
     <param-name>contextConfigLocation</param-name>
     <param-value>
         <!--加载多个spring配置文件 -->
         /WEB-INF/applicationContext.xml, /WEB-INF/action-servlet.xml
     </param-value>
 </context-param>

 <!-- 定义SPRING监听器,加载spring -->
 <listener>
     <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
 </listener>

 <listener>
     <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
 </listener>




您可能感兴趣的文章:

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wzffjz.html