Idea Integration Struts2+spring4+hibernate5

Source: Internet
Author: User
Objective

This article uses a simple example to introduce the use of idea integration struts2+spring4+hibernate5+mysql, the great God skipped, the end of the article with the source code download connection. 1. Database Design

First in MySQL new "SSH" database, new "product" table: including PID, pname, Price field, and set the PID primary key, automatic increment.

2, new project import jar package

Idea New Java Enterprise Project to import the necessary jar packages for Struts2, Spring4, Hibernate5, and of course, a jar package to connect mysq.

3. Write Java code and configuration file (CORE)

Code layering:

Action, Service, Dao, and domain layer.

Configuration file:

Web.xml (Configure Struts2 's core filters and spring's core listeners)

Log4j2.xml (Configuration Log)

Struts.xml (Configure action)

Applicationcontext.xml (Configure dependency Injection, transaction management, and Hibernate related properties, and data sources)

4, the writing interface

Here as a test, there is only one page: addproduct.jsp. 5, testing

To view the table records of a database:

6, download

1, this example source code download

2, Struts2+spring4+hibernate5+mysql the basic jar package download

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.