任何人都可以幫助我。我無法理解,爲什麼@RequestParameter或用request.getParameter()不工作(( 我的控制器:無法獲得請求參數從視圖到控制器Spring MVC
@Controller
public class CheatController extends WebMvcConfigurerAdapter {
@RequestMapping(value = "/hello", method = RequestMethod.GET)
public String hello(@RequestParam("gg") String gg, Model model) {
return "hello";
}
}
而我的觀點:
<html>
<body>
<form action="#" th:action="@{/hello}" method="get">
<input type="text" id="gg" name="gg" placeholder="Your data"/>
<input type="submit" />
</form>
<span th:if="${gg != null}" th:text="${gg}">Static summary</span>
</body>
</html>