标签:ping imp 页面 char doc work 文件 city start
JSP、Velocity、Freemarker、Thymeleaf(SpringBoot推荐)
<properties>
<thymeleaf.version>3.0.9.RELEASE</thymeleaf.version>
<thymeleaf-layout-dialect.version>2.2.2</thymeleaf-layout-dialect.version>
</properties>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
只要我们把HTML页面放在classpath:/templates/,thymeleaf就能自动渲染。
package com.atguigu.springboot.com.atguigu.springboot.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class HelloController {
@RequestMapping("/hello")
public String success(){
return "success";//classpath:/templates/success.html
}
}
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <body> <h1>成功!</h1> </body> </html>
标签:ping imp 页面 char doc work 文件 city start
原文地址:https://www.cnblogs.com/yangyh26/p/12303329.html