First of all, all the HTML files must be placed under the fixed path to be read correctly,/main/java/resources/templates this path, and all the HTML tags should be closed, or start error
Today called the template encountered a problem, the template named Hello.html, but the visit has been reported 404, it must not be properly returned by the controller, so it is not written in the controller, the following is the controller's code
@RequestMapping ("/aaa") PublicString Hello(modelmap map) {//add an attribute that is used to read from the templateMap.addattribute ("Host","http://blog.didispace.com"); //the name of the return template file, corresponding to the src/main/resources/templates/index.html return "Hello"; }
In order to access LOCALHOST:8080/AAA, the controller's method name and return value must be the same as HTML!!!!
Spring Boot integrated template engine Thymeleaf encountered in the pit