Skip to content

TemplateInputException #321

@weissliufeng

Description

@weissliufeng

Version: spring-boot-starter-thymeleaf 2.0.9.RELEASE

for bugs:
Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.thymeleaf.exceptions.TemplateInputException: Error resolving template [layouts/default], template might not exist or might not be accessible by any of the configured Template Resolvers] with root cause

org.thymeleaf.exceptions.TemplateInputException: Error resolving template [layouts/default], template might not exist or might not be accessible by any of the configured Template Resolvers

sample:

@RequestMapping({"news/{newsId}"})
public String news(Model model,
@RequestHeader(name = "name", required = false) String name,
@PathVariable("newsId") long newsId) {
logger.info("{} read news {}", name, newsId);

        try {
            NewsDto newsDto = newsService.info2(newsId, name);
            model.addAttribute("newsId", newsId);
            model.addAttribute("news", newsDto.getInfo());
            model.addAttribute("content", newsDto.getContent());
            return "news";
        } catch (Exception e) {
            logger.error("error ", e);
            return "redirect:/404";
        }
    }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions