spring中Request method 'post' not supported的原因
Request method ‘POST’ not supported是我在学习springmvc开发过程中遇到的一个异常。
@RequestMapping(value="emp", method=RequestMethod.POST)
public String SavedRequest(Employee employee){
employeeDao.save(employee);
return "redirect:/emps";
}
以上代码中笔者在此方法中现在有一个处理器方法SavedRequest,以POST的方法接收请求。该方法中将页面重定向到页面/emp并转发到另一个方法,另一个方法以GET请方法接收请求。
问题出现了,在以上过程中我以POST方法请求,处理器要以GET方法接收请求,两者不匹配,报错Request method ‘POST’ not supported。