thymeleaf 無法正常解析頁面(本地可以正常訪問某個請求,並可以返回頁面,但服務端訪問出現找不到模板)
出錯提示:
Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.thymeleaf.exceptions.TemplateInputException: Error resolving template [/admin/index], template might not exist or might not be accessible by any of the configured Template Resolvers] with root cause
解決方案:
之前的:
modelAndView.setViewName("/admin/index");
應該改成
modelAndView.setViewName("admin/index");
去掉/就可以正常路由了。
