Integration of struts + Spring + Hibernate Framework
Prepare the Lib package combined with the three frameworks
The steps of combining spring 3 with struts 2 are as follows:
1: Open struts 2 combined with spring 3, in struts Add the following statement to XML:
Java code:
2: On the web Add listener to XML as follows:
Java code:
3: On the web Specify the spring configuration file to be read initially in the XML, as follows:
Java code:
5. Of course, don't forget to add struts 2's own filter
4: In struts When configuring action in XML, it is as follows:
Java code:
5: You can define a bean normally in spring. Define an action as a bean, as follows:
Java code:
6: In the action of struts, the interfaces to be used can be injected by dependency injection.
summary
The above is the integration of struts + Spring + Hibernate framework introduced by Xiaobian. I hope it will help you. If you have any questions, please leave me a message and Xiaobian will reply to you in time. Thank you very much for your support for the programming tips website!