In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
Spring, Hibernate and Struts integration of the general idea is, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain in detail for you, people with this need can come to learn, I hope you can get something.
First, take a look at the integration of Struts and Spring.
Take a look at the changes you need to make in struts-config.xml, starting with the addition of the plug-in declaration:
Another thing that needs to be changed in the Struts configuration file is its ActionMapping section, which will be discussed later.
In fact, adding Spring to Struts is not very complicated, the most important thing is that we need to know whether the system must have Spring, that is, whether the so-called dependency injection of Spring is more meaningful to development than the increased development cost after using Spring.
The following diagram is used to illustrate the basic process of running the program after the combination of Struts and Spring:
As shown above, the most important thing about Struts's integration with Spring is to change the Action-Mapping settings in struts-config.xml, and Spring takes control before entering Struts's Action.
That's all for the integration of Spring and Struts.
With regard to the integration of Struts and Hibernate, the content is not very complex, I summed up the following points:
1 、 Hibernate-Context.xml
The SessionFactory property needs to be set in the entry of this file. Spring has integrated the SessionFactory setting, so there is no need to set the hibernate.cfg.xml again. At the same time, the list of the mapping file .hbm.xml can also be set in this item.
2. DAO inherits HibernateDaoSupport to call its functions
HibnernateDaoSupport implements the association between HibernateTemplate and SessionFactory. HibernateTemplate (available with getHibernateTemplate () in HibnernateDaoSupport) encapsulates Hibernate Session, eliminating a series of steps such as obtaining Session instances, transaction startup and commit / rollback, and exception handling, so it is very simple.
The above describes the integration of Struts, Spring and Hibernate from two aspects, which can be summarized briefly:
By modifying the configuration file of Struts, Spring is able to gain control of Action in Struts and also adds the features of Spring to Struts. Combined with Hibernate, the database operation is simplified by making use of the above Spring features.
Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.