"Persistence framework" SPRINGMVC+SPRING4+MYBATIS3 integration, development of simple Web project + source download

Source: Internet
Author: User
Tags create database

In the previous blog, we introduced the basic concepts and principles of mybatis, which we developed through spring and MyBatis to develop a simple user-censored Web project.

Basic Preparatory work

1, install JDK1.6 above version, installation and configuration

2. Download mybatis-3.2.0 version: https://repo1.maven.org/maven2/org/mybatis/mybatis/

3. Download mybatis-spring-1.2.1 version: https://repo1.maven.org/maven2/org/mybatis/mybatis-spring/

4, the Spring-4.0.0 version

5, tomacat6.x or above version can be

Of course, these jars are not enough, also need MySQL database and drive, log4j jar and so on. Let's start today's trip:


First step: Create a database table


Under Navicat, execute the following SQL command to create the database MyBatis and table T_user

[SQL] view plain copy print?   CREATE DATABASE IF not EXISTS mybatis; [SQL] view plain copy print?   Use MyBatis; [SQL] view plain copy print? CREATE TABLE T_user (user_id int (one) not NULL auto_increment, user_name varchar () is not NULL, USER_AG e varchar () NOT NULL, PRIMARY KEY (user_id)) Engine=innodb DEFAULT Charset=utf8;
Let's take a look at the full list of items before proceeding to the following content


Step Two: Add a jar package




For the contents of the following code, we will no longer one by one posted out, just the most important content posted out, we can download the source code.


Step Three: Create the Model

Create a model package and create a User.java file under it.

[Java] view plain copy print?      Package Com.tgb.model; /** * User * @author Liang * * */public class User {private int id;

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.