一、 提交方式
表单可以通过get/post接口提交,在RequestMapping中不指定method那么get/post都可以访问到,指定
method=RequestMethod.POST则只能通过post方式访问。
二、Controller层获取表单数据的三种方式
1. 在方法签名中添加HttpServletRequest参数,方法中通过HttpServletRequest.getParameter(“x”)方法得到对应的参数
2. 方法签名中使用@RequestParam注解获取表单字段对应的参数,有多少个字段就添加多少个对应的入参。
![](https://i-blog.csdnimg.cn/blog_migrate/ad0a105d34671c4aa6979d58d7e389cb.png)