Spring Boot integrated template engine Thymeleaf encountered in the pit

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.