Request method 'GET' not supported
原因:不支持Get方法访问
源代码
form表单用的是post方法提交,并没有使用get方法
<form action="employeesController/getEmps" method="post">
其对应的controller类的方法的注解
@RequestMapping(value="getEmps", method=RequestMethod.POST)
解决:
① 把controller类方法的注解中的“method = RequestMethod.POST” 去掉,就可以同时处理GET和POST请求
@RequestMapping(value="getEmps")
② 或在controller类改为Get方法(该方法单次执行有效,不建议使用)
@RequestMapping(value="getEmps", method=RequestMethod.GET)