0
点赞
收藏
分享

微信扫一扫

SpringBoot访问html

fbd4ffd0717b 2022-09-06 阅读 27


<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>

spring:
thymeleaf:
prefix: classpath:/templates/

@Controller
@RequestMapping("/view")
public class PageController {

@GetMapping("/link")
public String page() {
return "link";
}
}

在templates目录下创建html文件

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<h1>test</h1>
</body>
</html>

SpringBoot访问html_spring


​​http://localhost/view/link​​

SpringBoot访问html_html_02


举报

相关推荐

0 条评论