環境要求 環境: IDEA MySQL 5.7.19 Tomcat 9 Maven 3.6 要求: 需要熟練掌握MySQL資料庫,Spring,JavaWeb及MyBatis知識,簡單的前端知識; 項目結構圖 java目錄 pojo dao service controller resources目 ...
環境要求
環境:
- IDEA
- MySQL 5.7.19
- Tomcat 9
- Maven 3.6
要求:
- 需要熟練掌握MySQL資料庫,Spring,JavaWeb及MyBatis知識,簡單的前端知識;
項目結構圖
java目錄
- pojo
- dao
- service
- controller
resources目錄
- database.properties
- mybatis-config.xml
- spring-dao.xml
- spring-service.xml
- spring-mvc.xml
- applicationContext.xml
web目錄
- index.jsp
- WEB-INF
- jsp目錄
- web.xml
資料庫環境
創建一個存放書籍數據的資料庫表
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,'從刪庫到跑路'),
(3,'Linux',5,'從進門到進牢');
基本環境搭建
1、新建一Maven項目!ssmbuild , 添加web的支持
2、導入相關的pom依賴!
<dependencies>
<!--Junit-->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
<!--資料庫驅動-->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.47</version>
</dependency>
<!-- 資料庫連接池 -->
<dependency>
<groupId>com.mchange</groupId>
<artifactId>c3p0</artifactId>
<version>0.9.5.2</version>
</dependency>
<!--Servlet - JSP -->
<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</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<!--Mybatis-->
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.5.2</version>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
<version>2.0.2</version>
</dependency>
<!--Spring-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>5.1.9.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>5.1.9.RELEASE</version>
</dependency>
<!--lombok-->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.16.10</version>
</dependency>
<!--Aop-->
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>1.8.13</version>
</dependency>
</dependencies>
3、Maven資源過濾設置
<build>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
<filtering>false</filtering>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>
</build>
4、建立基本結構和配置框架!
java目錄 下建立四個包
com.qiu.pojo
com.qiu.dao
com.qiu.service
com.qiu.controller
mybatis-config.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
</configuration>
applicationContext.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
</beans>
Mybatis層編寫
1、資料庫配置文件 database.properties
jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/ssmbuild?useSSL=true&useUnicode=true&characterEncoding=utf8
jdbc.username=root
jdbc.password=123456
2、IDEA關聯資料庫
3、編寫MyBatis的核心配置文件
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
<settings>
<!--開啟Mybatis日誌-->
<setting name="logImpl" value="STDOUT_LOGGING"/>
</settings>
<typeAliases>
<!--修改對應實體類包-->
<package name="com.qiu.pojo"/>
</typeAliases>
<mappers>
<mapper resource="com/qiu/dao/BookMapper.xml"/>
</mappers>
</configuration>
4、編寫資料庫對應的實體類 com.qiu.pojo.Books
使用 lombok 插件!
package com.qiu.pojo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@NoArgsConstructor
@AllArgsConstructor
@Data
public class Books {
private int bookID;
private String bookName;
private int bookCounts;
private String detail;
}
5、編寫Dao層的 Mapper 介面!
package com.qiu.dao;
import com.qiu.pojo.Books;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface BookMapper {
//增加一本圖書
int addBook(Books books);
//刪除一本圖書
int deleteBook(@Param("bookId") int id);
//更新一本圖書
int updateBook(Books books);
//查詢一本圖書
Books queryBookById(@Param("bookId") int id);
//查詢全部的圖書
List<Books> queryAllBook();
//根據書名查詢圖書
List<Books> queryBookByName(@Param("bookName") String bookName);
}
6、編寫介面對應的 BookMapper.xml 文件。需要導入 MyBatis 的包;
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.qiu.dao.BookMapper">
<insert id="addBook" parameterType="Books">
insert into ssmbuild.books (bookName, bookCounts, detail)
values (#{bookName}, #{bookCounts}, #{detail});
</insert>
<delete id="deleteBook" parameterType="int">
delete from ssmbuild.books where bookID = #{bookId};
</delete>
<update id="updateBook" parameterType="Books">
update ssmbuild.books
set bookName = #{bookName},bookCounts = #{bookCounts},detail = #{detail}
where bookID = #{bookID};
</update>
<select id="queryBookById" parameterType="_int" resultType="Books">
select * from ssmbuild.books where bookID = #{bookId};
</select>
<select id="queryAllBook" resultType="Books">
select * from ssmbuild.books;
</select>
<select id="queryBookByName" parameterType="java.lang.String" resultType="Books">
select * from ssmbuild.books where bookName like concat('%',#{bookName},'%')
</select>
</mapper>
7、編寫 Service 層的介面和實現類
介面:
package com.qiu.service;
import com.qiu.pojo.Books;
import java.util.List;
public interface BookService {
//增加一本圖書
int addBook(Books books);
//刪除一本圖書
int deleteBook(int id);
//更新一本圖書
int updateBook(Books books);
//查詢一本圖書
Books queryBookById(int id);
//查詢全部的圖書
List<Books> queryAllBook();
//根據書名查詢圖書
List<Books> queryBookByName(String bookName);
}
實現類:
package com.qiu.service;
import com.qiu.dao.BookMapper;
import com.qiu.pojo.Books;
import java.util.List;
public class BookServiceImpl implements BookService {
//調用dao層的操作,設置一個set介面,方便Spring管理
private BookMapper bookMapper;
public void setBookMapper(BookMapper bookMapper) {
this.bookMapper = bookMapper;
}
public int addBook(Books books) {
return bookMapper.addBook(books);
}
public int deleteBook(int id) {
return bookMapper.deleteBook(id);
}
public int updateBook(Books books) {
return bookMapper.updateBook(books);
}
public Books queryBookById(int id) {
return bookMapper.queryBookById(id);
}
public List<Books> queryAllBook() {
return bookMapper.queryAllBook();
}
public List<Books> queryBookByName(String bookName) {
return bookMapper.queryBookByName(bookName);
}
}
底層需求操作編寫完畢!
Spring層編寫
1、配置Spring整合MyBatis,我們這裡數據源使用c3p0連接池;
2、我們去編寫Spring整合Mybatis的相關的配置文件;【spring-dao.xml】
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context https://www.springframework.org/schema/context/spring-context.xsd">
<!--1.關聯資料庫配置文件-->
<context:property-placeholder location="classpath:database.properties"/>
<!--2.連接池-->
<!--
dbcp:半自動化操作,不能自動連接
c3p0:自動操作(自動化的載入配置文件,並且可以自動設置到對象中!)
druid
hikari
-->
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
<property name="driverClass" value="${jdbc.driver}"/>
<property name="jdbcUrl" value="${jdbc.url}"/>
<property name="user" value="${jdbc.username}"/>
<property name="password" value="${jdbc.password}"/>
<!--c3p連接池的私有屬性-->
<property name="maxPoolSize" value="30"/>
<property name="minPoolSize" value="10"/>
<!--關閉連接後不自動commit-->
<property name="autoCommitOnClose" value="false"/>
<!--獲取連接超時時間-->
<property name="checkoutTimeout" value="10000"/>
<!--當獲取連接失敗重試次數-->
<property name="acquireRetryAttempts" value="2"/>
</bean>
<!--3.sqlSessionFactory-->
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<!--綁定Mybatis的配置文件-->
<property name="configLocation" value="classpath:mybatis-config.xml"/>
</bean>
<!--4.配置dao介面掃描包,動態的實現Dao介面可以註入到Spring容器中-->
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<!--註入 sqlSessionFactory-->
<property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"/>
<!--要掃描的dao包-->
<property name="basePackage" value="com.qiu.dao"/>
</bean>
</beans>
3、Spring整合service層(配置文件:spring-service.xml )
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/context
https://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/aop
https://www.springframework.org/schema/aop/spring-aop.xsd">
<!--1.自動掃描service 下的包-->
<context:component-scan base-package="com.qiu.service"/>
<!--2.將我們的所有業務類,註入到Spring,可以通過配置,或者註解實現-->
<bean id="bookServiceImpl" class="com.qiu.service.BookServiceImpl">
<property name="bookMapper" ref="bookMapper"/>
</bean>
<!--3.聲明式事務配置-->
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<!--註入數據源-->
<property name="dataSource" ref="dataSource"/>
</bean>
<!--4.aop事務支持-->
<!--結合AOP實現事務的織入-->
<!--配置事務通知:-->
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<!--給那些方法配置事務-->
<!--配置事務的傳播特性:new propagation= -->
<tx:attributes>
<!--一般只寫 * 的即可-->
<tx:method name="*" propagation="REQUIRED"/>
</tx:attributes>
</tx:advice>
<!--配置事務切入-->
<aop:config>
<!--切入點根據自己需要修改-->
<aop:pointcut id="txPointCut" expression="execution(* com.qiu.service.*.*(..))"/>
<aop:advisor advice-ref="txAdvice" pointcut-ref="txPointCut"/>
</aop:config>
</beans>
Spring層搞定!
SpringMVC層編寫
1、web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
version="4.0">
<!--DispatcherServlet-->
<servlet>
<servlet-name>SpringMVC</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>SpringMVC</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<!--亂碼過濾-->
<filter>
<filter-name>encodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>utf-8</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>encodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!--Session-->
<session-config>
<!--15分鐘過期-->
<session-timeout>15</session-timeout>
</session-config>
</web-app>
2、spring-mvc.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/context
https://www.springframework.org/schema/context/spring-context.xsd">
<!--1.註解驅動-->
<mvc:annotation-driven/>
<!--2.靜態資源過濾-->
<mvc:default-servlet-handler/>
<!--3.掃描包:controller-->
<context:component-scan base-package="com.qiu.controller"/>
<!--4.視圖解析器-->
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/jsp/"/>
<property name="suffix" value=".jsp"/>
</bean>
</beans>
3、Spring配置整合文件,applicationContext.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
<import resource="classpath:spring-dao.xml"/>
<import resource="classpath:spring-service.xml"/>
<import resource="classpath:spring-mvc.xml"/>
</beans>
配置文件,暫時結束!
Controller 和 視圖層
1、BookController 類編寫 ,方法一:查詢全部書籍
import com.qiu.pojo.Books;
import com.qiu.service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import java.util.List;
@Controller
@RequestMapping("/book")
public class BookController {
// controller 調用 service 層
@Autowired
@Qualifier("bookServiceImpl")
private BookService bookService;
//查詢全部的書籍,並且返回到一個書籍展示頁面
@RequestMapping("/allBook")
public String list(Model model){
List<Books> books = bookService.queryAllBook();
model.addAttribute("list",books);
return "allBook";
}
}
2、編寫首頁 index.jsp
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>主頁</title>
<style>
a{
text-decoration: none;
color:black;
font-size: 18px;
}
h3{
width:180px;
height: 38px;
margin: 100px auto;
text-align: center;
line-height: 38px;
background: deepskyblue;
border-radius:5px;
}
</style>
</head>
<body>
<h3>
<a href="${pageContext.request.contextPath}/book/allBook">進入書籍展示頁面</a>
</h3>
</body>
</html>
3、書籍列表頁面 allBook.jsp
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>書籍展示</title>
<%--BootStrap 美化界面--%>
<link href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class="container">
<div class="row clearfix">
<div class="col-md-12 column">
<div class="page-header">
<h1>
<small>書籍列表 ———— 顯示所有書籍</small>
</h1>
</div>
</div>
<div class="row">
<div class="col-md-8 column">
<%--查詢書籍--%>
<form action="${pageContext.request.contextPath}/book/queryBook" method="post" style="float:right" class="form-inline">
<span style="color:red;font-weight: bolder">${error}</span>
<input type="text" name="queryBookName" class="form-control" placeholder="請輸入要查詢的書籍名稱"/>
<input type="submit" value="查詢" class="btn btn-primary"/>
</form>
</div>
<div class="col-md-4 column">
<%--toAddBook--%>
<a class="btn btn-primary" style="float:right" href="${pageContext.request.contextPath}/book/toAddBook" >新增書籍</a>
</div>
</div>
</div>
<div class="row clearfix">
<div class="col-md-12 column">
<table class="table table-hover table-striped">
<thead>
<tr>
<th>書籍編號</th>
<th>書籍名稱</th>
<th>書籍數量</th>
<th>書籍詳情</th>
<th>操作</th>
</tr>
</thead>
<%--書籍從資料庫中查詢出來,從這個list中遍歷出來:foreach--%>
<tbody>
<c:forEach var="book" items="${list}">
<tr>
<td>${book.bookID}</td>
<td>${book.bookName}</td>
<td>${book.bookCounts}</td>
<td>${book.detail}</td>
<td>
<a href="${pageContext.request.contextPath}/book/toUpdateBook/${book.bookID}">修改</a>
|
<a href="${pageContext.request.contextPath}/book/deleteBook/${book.bookID}">刪除</a>
</td>
</tr>
</c:forEach>
</tbody>
</table>
</div>
</div>
</div>
</body>
</html>
4、BookController 類編寫 , 方法二:添加書籍
//跳轉到增加書籍頁面
@RequestMapping("/toAddBook")
public String toAddPaper(){
return "addBook";
}
//添加書籍的請求
@RequestMapping("/addBook")
public String addBook(Books books){
System.out.println("addBook=>" + books);
bookService.addBook(books);
return "redirect:/book/allBook"; //重定向到我們的allBook
}
5、添加書籍頁面:addBook.jsp
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>新增圖書</title>
<%--BootStrap 美化界面--%>
<link href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class="container">
<div class="row clearfix">
<div class="col-md-12 column">
<div class="page-header">
<h1>
<small>新增書籍</small>
</h1>
</div>
</div>
</div>
<form action="${pageContext.request.contextPath}/book/addBook" method="post">
<div class="form-group">
<label>書籍名稱:</label>
<input type="text" name="bookName" class="form-control" required>
</div>
<div class="form-group">
<label>書籍數量:</label>
<input type="text" name="bookCounts" class="form-control" required>
</div>
<div class="form-group">
<label>書籍描述:</label>
<input type="text" name="detail" class="form-control" required>
</div>
<div class="form-group">
<input type="submit" class="form-control" value="添加">
</div>
</form>
</div>
</body>
</html>
6、BookController 類編寫 , 方法三:修改書籍
//跳轉到修改書籍頁面
@RequestMapping("/toUpdateBook/{bookId}")
public String toUpdatePaper(@PathVariable ("bookId") int id,Model model){
Books book = bookService.queryBookById(id);
model.addAttribute("QBook",book);
return "updateBook";
}
//修改書籍的請求
@RequestMapping("/updateBook")
public String updateBook(Books books){
System.out.println("updateBook=>" + books);
bookService.updateBook(books);
return "redirect:/book/allBook";
}
7、修改書籍頁面 updateBook.jsp
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>修改圖書</title>
<%--BootStrap 美化界面--%>
<link href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class="container">
<div class="row clearfix">
<div class="col-md-12 column">
<div class="page-header">
<h1>
<small>修改書籍</small>
</h1>
</div>
</div>
</div>
<form action="${pageContext.request.contextPath}/book/updateBook" method="post">
<input type="hidden" name="bookID" value="${QBook.bookID}">
<div class="form-group">
<label>書籍名稱:</label>
<input type="text" name="bookName" class="form-control" value="${QBook.bookName}" required>
</div>
<div class="form-group">
<label>書籍數量:</label>
<input type="text" name="bookCounts" class="form-control" value="${QBook.bookCounts}" required>
</div>
<div class="form-group">
<label>書籍描述:</label>
<input type="text" name="detail" class="form-control" value="${QBook.detail}" required>
</div>
<div class="form-group">
<input type="submit" class="form-control" value="修改">
</div>
</form>
</div>
</body>
</html>
8、BookController 類編寫 , 方法四:刪除書籍
//刪除書籍
@RequestMapping("/deleteBook/{bookId}")
public String deleteBook(@PathVariable ("bookId") int id){
bookService.deleteBook(id);
return "redirect:/book/allBook";
}
9、BookController 類編寫 , 方法五:根據書名模糊查詢書籍
//查詢書籍
@RequestMapping("/queryBook")
public String queryBook(String queryBookName,Model model){
List<Books> books = bookService.queryBookByName(queryBookName);
if(books.size()==0){
books=bookService.queryAllBook();
model.addAttribute("error","未查到");
}
model.addAttribute("list",books);
return "allBook";
}
配置Tomcat,進行運行!
到目前為止,這個SSM項目整合已經完全的OK了,可以直接運行進行測試!
本篇總結參考 B站狂神說Java:https://space.bilibili.com/95256449