后台:
@GetMapping("/globalVerify") public String globalVerify(Model model) { String rep_id = System.currentTimeMillis() + ""; model.addAttribute("repId", rep_id); list=xxx; model.addAttribute("list", list); return "m_report"; }
1、在JavaScript中获取Model值
var repId = '${repId}';
但是搞不定,大概率model已经失效了。
2、在thymleaf中获取Model值
// th:each="i:${list}" <table th:each="i:${list}"> <tr> <td>Id</td> <td th:text="${i.getId()}"></td> </tr> <td>Name</td> <td th:text="${i.getName()}"></td> </tr> </table>
参考:https://blog.csdn.net/qq_34037264/article/details/103056303