1 步骤
1.1
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/dfa5bd403f116d78153f343465f220ec.png)
1.2
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/693a4694b5b479dd95785ddc385740d7.png)
1.3
server:
port: 6666
servlet:
context-path: /
spring:
datasource:
#数据库驱动 高版本 com.mysql.cj.jdbc.Driver
#低版本 com.mysql.jdbc.Driver
#driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://127.0.0.1:3306/hui?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8&autoReconnect=true&allowMultiQueries=true
username: root
password: root
thymeleaf:
prefix: classpath:/templates/pages/
suffix: .html
mybatis:
#定义别名包
type-aliases-package: com.cy.pojo
#添加映射文件
mapper-locations: classpath:/mybatis/mappers
1.4
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/8a846151bdf052a1132c3c166c3600bb.png)
1.5
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/37a12919f96d486b4892e2ed8a5a77eb.png)
1.6
![](https://i-blog.csdnimg.cn/blog_migrate/c46a148ea09687b26a11684563e3a4fe.png)
1.7
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/2c32accd4b100280d1934bf7018227d0.png)
1.8
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/d9f996426912478bad1187131c2f63a8.png)
1.9
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/7f505bb29cbe38167e84130906f820b1.png)
1.10
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="js/jquery-3.5.1.js"></script>
<script type="text/javascript">
$(function(){
$.get("/getAllUser",function(result){
addTable("tab1",result);
})
function addTable(eleId,data){
var trs = "";
$(data).each(function(index,user){
var id = user.id;
var name = user.name;
var age = user.age;
var sex = user.sex;
trs += "<tr align='center'><td>"+id+"</td><td>"+name+"</td><td>"
+age+"</td><td>"+sex+"</td></tr>"
});
$("#"+eleId).append(trs);
}
$.ajax({
type: "post",
url: "/getAllUser",
dataType: "json",
success: function(result){
addTable("tab2",result);
},
error :function(data){
alert("提示信息: 当前网络正忙,请稍后再试");
},
async : true,
cache : false
});
})
</script>
</head>
<body>
<table id="tab1" border="1px" width="65%" align="center">
<tr>
<td colspan="6" align="center"><h3>用户信息</h3></td>
</tr>
<tr>
<th>编号</th>
<th>姓名</th>
<th>年龄</th>
<th>性别</th>
</tr>
</table>
</body>
</html>
1.11
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/e8145b318fb6e4024a041e2ef17fdd1b.png)