目录
■相关知识
■代码
UserController2
helloThymeleafMyBatis.html
■效果
■DB数据
■相关知识
SpringBoot + MyBatis 之 Hello World_sun0322-CSDN博客
SpringBoot + Thymeleaf 之 HelloWorld_sun0322-CSDN博客
■代码
UserController2
package com.sxz.test.one.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import com.sxz.test.one.entity.User;
import com.sxz.test.one.service.UserService;
@Controller
@RequestMapping("/user")
public class UserController2 {
@Autowired
UserService userService;
@RequestMapping("/findAll2")
public String findAll(Model model){
List userList = userService.findAll();
model.addAttribute("userList",userList);
return "helloThymeleafMyBatis.html";
}
}
helloThymeleafMyBatis.html
helloThymeleafMyBatis页面
table { background:#DCDFE6; width: 100%; }
table th { background:#DDEBF7; }
table tbody td { background:#FFFFFF; }
id
password
权限
■效果
package com.sxz.test.one.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import com.sxz.test.one.entity.User;
import com.sxz.test.one.service.UserService;
@Controller
@RequestMapping("/user")
public class UserController2 {
@Autowired
UserService userService;
@RequestMapping("/findAll2")
public String findAll(Model model){
List userList = userService.findAll();
model.addAttribute("userList",userList);
return "helloThymeleafMyBatis.html";
}
}
helloThymeleafMyBatis.html
helloThymeleafMyBatis页面
table { background:#DCDFE6; width: 100%; }
table th { background:#DDEBF7; }
table tbody td { background:#FFFFFF; }
id
password
权限
■效果
| id | password | 权限 |
|---|---|---|
■DB数据
---



