刚进公司 自己搭建springboot项目遇到这个错误
记录以后学习更多的知识和经验
springboot 使用thymeleaf 导致该错误
导入包
<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-thymeleaf</artifactId></dependency>
以下为配置文件application.properties
spring.thymeleaf.cache=false
de= LEGACYHTML5
sources.t.enabled=true
sources.t.paths=/**
spring.thymeleaf.check-template = true
spring.t-type=text/html
abled = true
ding = UTF-8
spring.thymeleaf.prefix = classpath:/static/
spring.thymeleaf.suffix = .html
@Controller
public class TestController {@RequestMapping("/test")public ModelAndView test(){ModelAndView modelAndView = new ModelAndView();modelAndView.setViewName("login");return modelAndView;}
}
springboot 使用thymeleaf 动态页面
跳转静态页面需要经过controller层才能实现跳转 (不经过静态资源报错)
否则 报 No mapping for GET错误
不当之处,敬请指正
本文发布于:2024-01-29 12:51:04,感谢您对本站的认可!
本文链接:https://www.4u4v.net/it/170650386615405.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
留言与评论(共有 0 条评论) |