提交后将模型对象从百里香叶传递到控制器

时间:2018-06-28 17:05:00

标签: 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>



@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";
    }

正在打印:

received size on map is 0 , despite the map size is 3 when i redirecting from other controller.

0 个答案:

没有答案