Spring|Spring boot 使用thymeleaf实现局部刷新

【Spring|Spring boot 使用thymeleaf实现局部刷新】html:

问题类型 报修时间 地址 问题描述

js:
function getRepair() { var url = "/getRepair"; $("#recording").load(url); }

后台java:
@Controller public class GetController { @Autowired private RepairRepositories repairRepositories; @RequestMapping({"/getRepair"}) public String getRepair(ModelMap modelMap, HttpSession session) { Integer userId = (Integer) session.getAttribute("user_id"); List repairs = repairRepositories.getRepair(userId); modelMap.addAttribute("repair",repairs); return "payCenter::recording"; } }

注意:注解用@Controller注解,不能使用@ResponseBody注解或者@RestController注解
否则页面上显示的是
payCenter::recording

    推荐阅读