最近回顾了下之前的知识,在使用注解整合SpringMVC+Thymeleaf时遇到点小bug
我的Bug环境(Spring5)
我是照着官网的配置来的,错误的起因在这一处配置上:
问题出在`viewResolver.setViewNames(new String[]{".html", ".xhtml"});`这行代码上,注释即可
此配置的含义是:
当我们需要使用多个模板引擎时,例如JSP+Thymeleaf时候,我们需要区分一下我们的定义的这个试图解析器,需要解析哪些文件,所以这样的话,也可以将代码改成如下形式,也可解决此Bug,如下(home,user分别代表"home.html","user.html")
本解决方案只是提供了在本环境下的一种可能方案,不能保证一定有效,如有建议,评论区留言
相关文章
- databus编译:Could not resolve all dependencies for configuration ':databus2-relay:databus2-event-producer-mock:compile
- 搭建github-ssh连接时,Could not resolve hostname github的解决方案(无法ping通github)
- 解决ssh: Could not resolve hostname ***: nodename nor servname provided, or not known报错
- ssh: Could not resolve hostname
- c-version:null]] could not deserialize the servlet-context scoped attribute with name: "MENU_LIST"
- INS-40904 ORACLE_HOSTNAME Does not Resolve to a Valid Host Name [ID 1281039.1]
- IPPICV: Download failed: 6;“Couldn‘t resolve host name“
- couldnt resolve host name
- SVN: Could not resolve hostname 解决方法_
- mysql显示错误日志 [Warning] IP address ‘xxxx‘ could not be resolved: Name or service not known错误解决