springboot学习笔记

 thymeleaf使用:th:type  type为我们需要展示的信息的类型可以为text

<h3  th:each= "user:${user}"  th:text="${user}"></h3> 遍历并且输出为text 前一个user为
mode.addAttribute("user", Arrays.asList("guosai","lifei","huanglun")); 中的user 

后一个user为遍历出来的每一个user



@Controller
public class HelloController {

@GetMapping(value = "hello")
public String index( Model mode){
//mode.addAttribute("msg","hello,springboot");
mode.addAttribute("user", Arrays.asList("guosai","lifei","huanglun"));
return "test";//返回值就是最后跳转的页面
}
}
 

原文地址:https://www.cnblogs.com/guosai1500581464/p/13425915.html