【发布时间】:2013-04-29 03:14:14
【问题描述】:
我正在尝试将请求转发到另一个接受 GET 请求的 Spring 控制器,但它告诉我不支持 POST。这是我的第一个控制器方法的相关部分,它确实需要一个 POST 请求,因为我将它用于登录功能。
@RequestMapping(value = "/login", method = RequestMethod.POST)
public String login(@ModelAttribute("administrator") Administrator administrator,
Model model) {
// code that's not germane to this problem
return "forward:waitingBulletins";
}
这是我要转发的方法。
@RequestMapping(value = "/waitingBulletins", method = RequestMethod.GET)
public String getWaitingBulletins(Model model) {
// the actual code follows
}
这是我浏览器中的错误消息。
HTTP Status 405 - Request method 'POST' not supported
--------------------------------------------------------------------------------
type Status report
message Request method 'POST' not supported
description The specified HTTP method is not allowed for the requested resource (Request method 'POST' not supported).
【问题讨论】:
标签: spring-mvc http-status-code-405