参考:(68条消息) spring boot (五)表单处理_2020越努力越幸运的博客-CSDN博客_springboot表单
@GetMapping("/index") public String blog(Model model) { model.addAttribute("blogs",new Blog()); return "index"; }
index.html
<form action="#" th:action="@{/blogs/result}" th:object="${blogs}" method="post"> <input type="text" th:field="*{id}"> <input type="text" th:field="*{content}"> <input type="submit" value="提交"> </form>
@PostMapping("/blogs/result") public String create(@ModelAttribute Blog blog) { return "result"; }
标签:index,springboot,form,表单,Blog,result,String From: https://www.cnblogs.com/huaobin/p/16801219.html