Exception: Error resolving template "xxx", template might not exist or might not being accessible ... Solutions

Source: Internet
Author: User

Simple statement: The console has this exception: Error resolving template "xxx", template might not exist or might not being accessible by any of the Configur Ed Template resolvers

Workaround: Add annotations on the method that reported the exception @responsebody

To tell you the personal understanding: This annotation is used to distinguish between the method's return value string and the View resolver parsing the page name of the string conflict, for example: Method A returns the string success, if the Ajax callback function with the MSG match, will pop up a "successful execution",   Because success is just a normal string, add @responsebody to the top of the method. The return value of method B is "/contextlist", and this is a page contextlist.jsp or contextlist.html (specifically what to look at the configuration, anyway, is a page).

Online Find information (blog link: 80989584):

The Controller layer plus annotations @controller and @restcontroller both can be on the front-end of the interface, but the difference is that when using the former must be added to the method of annotation @responsebody, If you do not add @responsebody, the above error is reported because the spring default method returns a View object (page) when using @controller annotations. With @responsebody, the method returns the specific object. The function of the @RestController is equivalent to the @[email protected] binding body

Exception: Error resolving template "xxx", template might not exist or might not being accessible ... Workaround

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.