我试图将单个字符串发送到我的Spring后端。我不想为该字符串创建额外的Object。
<form name="f" th:action="@{/restaurant_SaveLayout}" method="post">
<input type="hidden" value="trdz234"/>
<button type="submit"></button>
</form>
Spring告诉我,我的RequestParam不存在。
@PostMapping("/restaurant_SaveLayout")
public String restaurant_SaveLayout (@RequestParam String circles) {
return "restaurant_ShowArr";
}
我也不想通过GET发送任何内容。
答案 0 :(得分:1)
您错过了设置输入的名称。
<form name="f" th:action="@{/restaurant_SaveLayout}" method="post">
<input type="hidden" name="circles" value="trdz234"/>
<button type="submit"></button>
</form>