【发布时间】:2017-05-03 02:31:51
【问题描述】:
我从表单发送一个动作到
<form name='recoverForm' action="<c:url value='recover'/>" method='POST'>
春天:
@Controller
@RequestMapping(value = "recover")
public class RecoverController {
@RequestMapping(method = RequestMethod.GET)
public String recoverPage(Map<String, Object> model) {
return "recover"; //this works
}
@RequestMapping(method = RequestMethod.POST)
public String recover(Map<String, Object> model) {
System.out.println("_____________recover in action");
return "home"; //error 405
}
但我收到错误 405 - 不支持请求方法“POST”。
为什么会这样?我发送post request 和控制器有一个post 方法不是吗?
【问题讨论】:
-
你的
GET有用吗? -
@timothyclifford 是的,它有效
-
当你的应用启动时,你能在日志中看到被映射的 POST 路由吗?
-
@timothyclifford 不确定,你是什么意思
-
你用的是什么版本的 Spring?
标签: spring spring-mvc http-status-code-405