搜索
您的当前位置:首页springboot用controller跳转html页面

springboot用controller跳转html页面

来源:智榕旅游
springboot⽤controller跳转html页⾯

之前SSM框架,⾥⾯有webapps⽂件夹,⽤来存放前端页⾯和各种前端资源,现在SpringBoot中没有webapps⽂件夹,springboot结构如下:

第⼀、resourses下⽂件夹public是我⾃⼰创建的,通过local host:8080/index.html可以直接访问。第⼆、通过controller层访问templates中的⽂件夹:

步骤⼀、application.properties 配置中添加spring.thymeleaf.prefix=classpath:/templates/

步骤⼆、pom.xml⽂件中添加依赖:

org.springframework.boot

spring-boot-starter-thymeleaf

步骤三、controller层访问http://localhost:8080/test :

打完收⼯。

因篇幅问题不能全部显示,请点此查看更多更全内容

Top