package com.zzx.controller; import com.zzx.model.User; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import java.util.Arrays; /** * @date: 2021/04/25/ 10:07 * @author: ZhengZiXuan * @description: 由于Spring Boot 不推荐我们使用.jsp,所以我们就使用html配合thymeleaf来进行数据的传输 * @title: Thymeleaf简单使用 */ @Controller @RequestMapping("/thyme") public class ThymeleafController { @RequestMapping("data") public String ShowData(Model model){ model.addAttribute("text","点击1"); model.addAttribute("utext","点击1"); model.addAttribute("value","input值"); model.addAttribute("user",new User(1,"张三")); model.addAttribute("num",100); model.addAttribute("flag",true); model.addAttribute("list", Arrays.asList("Java","WEB","UI")); return "data"; } }
id:
name:
看这里看这里
到此这篇关于Java基础之Thymeleaf的简单使用的文章就介绍到这了,更多相关Java Thymeleaf的使用内容请搜索以前的文章或继续浏览下面的相关文章希望大家以后多多支持!