任何人都可以帮助我。我无法理解,为什么@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>