完整错误信息:
org.thymeleaf.exceptions.TemplateInputException: Error resolving template [cart/selected/cartItems], template might not exist or might not be accessible by any of the configured Template Resolvers
译文:
解析模板[cart/selected/cartItems]时出错,模板可能不存在,或者任何已配置的模板解析程序都无法访问该模板
解决:
- 如果你想让
cart/selected/cartItems
请求下面的方法返回json格式数据,那你就是忘记在方法上加@ResponseBody
注解了,如果不添加该注解,返回String
字符串将会被当做Thymeleaf模板
的名称去找对应的html模板文件
,但找不到该模板文件,所以会出现上述错误 - 如果你想让
cart/selected/cartItems
请求下面的方法指向某个Thymeleaf模板
,那就是你return
后面的模板名称写错了