博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Spring Boot整合Web开发-如何集合模板Thymeleaf?
阅读量:2079 次
发布时间:2019-04-29

本文共 1101 字,大约阅读时间需要 3 分钟。

跟杨春娟学SpringBoot笔记:Spring Boot整合Web开发-如何集合模板Thymeleaf?

完成:第一遍

1.如何Spring Boot整合Web开发-如何集合模板Thymeleaf?

步骤一:pom.xml加入Thymeleaf依赖

org.springframework.boot
spring-boot-starter-thymeleaf

步骤二:thymeleaf有一些配置如何在网上查找?

输入https://spring.io
然后Projects里选择SpringBoot
然后选LEARN,下载DOC讲解文档

步骤三:在src/main/resources下的

application.properties属性文件中配置thymeleaf
spring.thymeleaf.cache=false

#thymeleafspring.thymeleaf.cache=false

步骤四:src/main/resources/templates下的thymeleaf.html

src/main/resources/templates下的thymeleaf.htm

	This is a Thymeleaf page	
This is Thymeleaf page!

步骤五:ThymeleafController

ThymeleafController

package com.springboot.demo.SpringBootDemoProject.thymeleaf;import org.springframework.stereotype.Controller;import org.springframework.ui.ModelMap;import org.springframework.web.bind.annotation.RequestMapping;//必须和前台交互就不能用RestController@Controller@RequestMapping("t")public class ThymeleafController {
@RequestMapping("show") public String show(ModelMap model) {
model.addAttribute("welcome", "Welcome to my website!"); return "thymeleaf"; }}

转载地址:http://trzqf.baihongyu.com/

你可能感兴趣的文章
【LEETCODE】240-Search a 2D Matrix II
查看>>
【LEETCODE】53-Maximum Subarray
查看>>
【LEETCODE】215-Kth Largest Element in an Array
查看>>
【LEETCODE】312-Burst Balloons
查看>>
【LEETCODE】232-Implement Queue using Stacks
查看>>
【LEETCODE】225-Implement Stack using Queues
查看>>
【LEETCODE】155-Min Stack
查看>>
【LEETCODE】20-Valid Parentheses
查看>>
【LEETCODE】290-Word Pattern
查看>>
【LEETCODE】36-Valid Sudoku
查看>>
【LEETCODE】205-Isomorphic Strings
查看>>
【LEETCODE】204-Count Primes
查看>>
【LEETCODE】228-Summary Ranges
查看>>
【LEETCODE】27-Remove Element
查看>>
【LEETCODE】66-Plus One
查看>>
【LEETCODE】26-Remove Duplicates from Sorted Array
查看>>
【LEETCODE】118-Pascal's Triangle
查看>>
【LEETCODE】119-Pascal's Triangle II
查看>>
word2vec 模型思想和代码实现
查看>>
怎样做情感分析
查看>>