Spring Integrated STRUTS2

Source: Internet
Author: User

1.1. Spring Integrated STRUTS2

1) The Spring user mobile Web-inf the next


2) Configure the spring configuration file in Web. xml

<!--introduce spring configuration files--

<context-param>

<param-name>contextConfigLocation</param-name>

<param-value>/WEB-INF/applicationContext.xml</param-value>

</context-param>

3) Configure spring monitoring in Web. xml

<!--Spring Listener--

<listener> <listener-class>org.springframework.web.context.contextloaderlistener</listener-class >

</listener>

4) Configure the Struts2 action in the spring configuration file

<bean id= "useraction" class= "Com.morris.spring.action.UserAction" >

</bean>

5) Introduction of spring constants in the STRUTS2 configuration file

<constant name= "objectfactory" value= "Spring" ></constant>

6) Configure the Action,class as the ID value configured in spring in the Struts2 configuration file

<package name= "Default" extends= "Struts-default" namespace= "/" >

<action name= "Welcome" class= "useraction " method= "Welcome" >

<result>/index.jsp</result>

</action>

</package>

Copyright notice: This article blog original articles, blogs, without consent, may not be reproduced.

Spring Integrated STRUTS2

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.