day08: service_search微服务: 用thymeleaf模板 实现前端搜索页面的渲染
1. 报错如下:
An error happened during template parsing(template: "class path resource [templates/serach.html]")

2. 原因: searchController搜索方法中的传参注解错误, 导致前端无法接收到controller的参数
3. 解决方法: 把 @PathVariable路径变量 修改为 注解@RequestParam
4. 拓展:
@RequestParam:将请求参数绑定到你控制器的方法参数上(是springmvc中接收普通参数的注解)
本文解决了一个关于Thymeleaf模板引擎在渲染前端搜索页面时遇到的错误。错误源于Controller方法中注解使用不当,文章详细介绍了如何通过调整注解类型来解决问题,并解释了@RequestParam和@PathVariable的区别。
1902

被折叠的 条评论
为什么被折叠?



