Spring 提交后将模型对象从thymeleaf传递给控制器
从thymeleaf我提交了一份表格,然后试图在控制器上读取模型,但它不起作用Spring 提交后将模型对象从thymeleaf传递给控制器,spring,thymeleaf,Spring,Thymeleaf,从thymeleaf我提交了一份表格,然后试图在控制器上读取模型,但它不起作用 <form action="#" th:action="@{/activate}" th:object="${complete_map}" method="post"> <p><input type="submit" value="Submit" /> <input type="reset" value="Reset" /></p
<form action="#" th:action="@{/activate}" th:object="${complete_map}" method="post">
<p><input type="submit" value="Submit" /> <input type="reset" value="Reset" /></p>
</form>
@PostMapping("/activate")
public String greetingSubmit(Model m) {
System.out.println("Got the map and the siz");
System.out.println("received size on map is "+m.asMap().size());
return "telco";
}
您没有提交表单中的任何数据如何提交?您想提交什么?为您想要的每个字段输入表单,例如……我想传递完整的对象“complete_map”,这是一个映射。您的表单需要输入元素。仅设置属性th:object是不够的。另外,动态绑定是不可能的。
received size on map is 0 , despite the map size is 3 when i redirecting from other controller.