SSH Integration Basics

Source: Internet
Author: User

1.Spring Integrated Hibernate
Integration steps
Guide Package
Configure Appliactioncontext.xml
Creating entity classes and mapping relationship files
Creating DAO interfaces and Implementing classes
Declaring DAO components, injecting sessionfactory

2.Spring Integrated STRUTS2
Guide Package
Configure Web. xml
Configure Applicationcontext.xml to turn on annotation scanning
Create and declare an action
Configure action
Create JSP

3. Fundamentals of Integration
Struts originally used Strutsobjectfactory to read Struts.xml, creating an action based on the type specified in the action element.
Object.
After the spring integration Struts2 package is introduced, Strutsobjectfactory is replaced by Strutsspringobjectfactory, and
The latter reads Struts.xml and creates the action object from the spring container, based on the component ID specified in the action element.
The reason Strutsspringobjectfactory will take effect is because the configuration in configuration file Struts-plugin.xml under the integration package
The Struts2 itself supports spring, but this support is only turned off by default, and the above configuration is just a rack to turn this support on. and the default support for spring,
Defined in the Org.apache.struts2.default.properties

4.SSH Integration
Guide Package
Integrate Hibernate with spring
Using spring to integrate Hibernate, complete the DAO interface and implementation classes, please refer to the steps of Spring integration hibernate.
Using spring to integrate STRUTS2
Use spring to integrate the STRUTS2 to complete the processing of the request, please refer to the steps of spring integration Struts2.

6. How to get session
In hibernate, paged queries are implemented uniformly through the query object setting parameters, and after using spring to integrate Hibernate, the session
It is maintained by spring and is not directly exposed to the developer. If you want to get to the session in such a program, create a Query object
For paging, you need to use the Executefind method in Hibernatetemplate

SSH Integration Basics

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.