Day21-SSM项目整合
-
新建数据库
CREATE DATABASE ssmbuild;
USE `ssmbuild`
DROP TABLE IF EXISTS `books`;
CREATE TABLE `books`(
`bookID` INT (10) NOT NULL AUTO_INCREMENT COMMENT '书id',
`bookName` VARCHAR (100) NOT NULL COMMENT '书名',
`bookCounts` INT (11) NOT NULL COMMENT '数量',
`detail` VARCHAR (200) NOT NULL COMMENT '描述',
KEY `bookID` (`bookID`)
)ENGINE=INNODB DEFAULT CHARSET=utf8
INSERT INTO `books`(`bookID`, `bookName`, `bookCounts`,`detail`) VALUES
(1,'Java',1,'从入门到放弃'),
(2, 'MySQL',10,'MySQL从删库到跑路'),
(3,'Linux',5,'从进门到进牢'); -
新建maven项目
-
导包(junit、数据库驱动、连接池【c3p0】、servlet、jsp、mybatis、mybatis-spring、spring、json)
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.25</version>
</dependency>
<dependency>
<groupId>com.mchange</groupId>
<artifactId>c3p0</artifactId>
<version>0.9.5.5</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.2.1-b03</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.5.13</version>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
<version>2.0.7</version>
</dependency>
<dependency>
<groupId