thymeleaf 無法正常解析頁面(本地可以正常訪問某個請求,並可以返回頁面,但服務端訪問出現找不到模板)


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");

去掉/就可以正常路由了。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM