最近在学习springboot,后台返回controller直接返回templates下的html是没问题的,但是返回templates子文件中html就会报错org.thymeleaf.exceptions.TemplateInputException: Error resolving template “product/errorr”, template might not exist or might not be accessible by any of the configured Template Resolvers,研究半天,只要将controller返回类型改为ModelAndView 即可不报错
@RequestMapping("/getProductList")
public ModelAndView getProductList() {
ModelAndView model=new ModelAndView();
model.setViewName("product/error");
return model ;
// return "/product/error";
}
希望有用