Spring and Struts 2 Integration
Spring structure gives a simple method to deal with the reliance. It very well may be effectively coordinated with struts2 2 framework.
The ContextLoaderListener class is utilized to impart spring application with struts2 2. It must be indicated in the web.xml file.
You need to follow following steps:
- Create struts2 application and include spring container files.
- In web.xml document, characterize ContextLoaderListener class.
- In struts.xml document, characterize bean name for the activity class.
- In applicationContext.xml document, make the bean. Its class name ought to be activity class name for example com.javatpoint.Login and id should coordinate with the activity class of struts.xml document (for example login).
- In the action class, characterize additional property for example message.
Example of Spring and Struts 2 Integration
You need to create following files for simple spring and struts 2 application: