Yonago ssh path (ii) SSH configuration (2) Integrated STRUTS2

Source: Internet
Author: User

The previous article has already talked about the Spring2.5 configuration, this chapter is about how to integrate struts on the Spring2.5.

Third, integrated Struts2 in Spring2.5

3.1 Modify the existing web.xml.

Add the following two paragraph code:

<filter> 

<filter-name>struts2</filter-name> 

<filter-class>org.apache.str uts2.dispatcher.filterdispatcher</filter-class> 

</filter>

<filter-mapping> 

<f ilter-name>struts2</filter-name> 

<url-pattern>/*</url-pattern> 

</filter-mapp Ing>

3.2 Complete Web.xml Code

<?xml version= "1.0" encoding= "UTF-8"?> <web-app id= "webapp_id" version= "2.4" xmlns= "Http://java.sun.com/xml" /ns/j2ee "xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance "xsi:schemalocation=" http://java.sun.com/xml/ns/

    Java http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd "> <!--######################################--> <!--########## Struts2 ##################--> <!--######################################--> & lt;! * STRUTS2 's main filter, responsible for four aspects of the function: * (1) Perform actions * (2) Clear Actioncontext * (3) Maintain static content * (4) Clear re The interceptors of the Xwork in the Quest lifecycle * Note: The filter should filter all request URLs.  

        Generally set to/* ************--> <filter> <filter-name>struts2</filter-name> <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class> </filter> &L t;! --######################################--> <!--########## Spring2 ##################--> <!--######################################--> <!--* [<context-param>& Lt;/context-param] => is used to set the environment parameters of the Web site * [<param-name></param-name>] (child element) => the name of the parameter to specify * [ <param-value></param-value>] (child element) => is used to set the parameter value * ************ * Load Spring's configuration file from the Classpath, multiple profiles can be comma-and Space distinction * CLASSPATH: keyword refers to the class path loading ********************--> <context-param> <param-name& Gt;contextconfiglocation</param-name> <param-value>classpath:applicationcontext*.xml</  Param-value> </context-param> <!--* [<listener></listener>]=> used to set the listening interface * [<listener-class></listener-class>] (child element) => define Listener class name * ******* * Responsible for starting the spring listener * It takes the context parameter at the reference to the spring configuration file address * Specify Spring-provided Conte Xtloaderlistener Web Container Listener, * The listener runs automatically when the Web container starts and gets the spring configuration file based on the Contextloaderlistener parameter * and starts the SprinG container. --> <listener> <listener-class> org.springframework.web.context.c Ontextloaderlistener </listener-class> </listener> <filter-mapping> <fi Lter-name>struts2</filter-name> <url-pattern>/*</url-pattern> &LT;/FILTER-MAPPING&G  

    T <display-name>miziStudy</display-name> <welcome-file-list> <welcome-file>index.html& Lt;/welcome-file> <welcome-file>index.htm</welcome-file> <welcome-file>index.jsp&lt ;/welcome-file> <welcome-file>default.html</welcome-file> <welcome-file>default.htm </welcome-file> <welcome-file>default.jsp</welcome-file> </welcome-file-list> </ Web-app>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.