想构建简单页面跳转,正常跳转index.html,404和500跳转到专门的页面,配置正确,路径也正确,controller的方法也能访问到,但是一直无法正常跳转,页面报404.修改版本后,可以正常访问。
@Controller public class IndexController { @GetMapping("/") public String index() { // int i = 9 / 0; System.out.println("HelloWorld!"); return "index"; } }
记录一下目前可以正常使用的版本(2020-12-23)
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<thymeleaf.version>3.0.11.RELEASE</thymeleaf.version>
<thymeleaf-layout-dialect.version>3.0.0</thymeleaf-layout-dialect.version>
</properties>
@Controller public class IndexController { @GetMapping("/") public String index() { // int i = 9 / 0; return "index"; } }
@Controller public class IndexController { @GetMapping("/") public String index() { int i = 9 / 0; return "index"; } }
SpringBoot 使用thymeleaf 跳转页面时,总是提示404找不到页面
原文:https://www.cnblogs.com/Bernard94/p/14178050.html