Spring MVC / Roo - 不支持请求方法'GET'

时间:2012-02-23 16:19:22

标签: spring spring-mvc spring-roo

@RequestMapping(value = "/tusers")
@Controller
@RooWebScaffold(path = "tusers", formBackingObject = TUser.class)
public class UserController {


@RequestMapping(value = "/tusers/{id}", produces = "text/html", method = RequestMethod.GET)
public String show(@PathVariable("id") Long id, Model uiModel) {
    uiModel.addAttribute("object", tUserService.findTUser(id));
    uiModel.addAttribute("itemId", id);
    return "tusers/show";
}

为什么这会给我HTTP状态405 - 网址不支持请求方法'GET':http://localhost:8080/twiter-roo/tusers/1

1 个答案:

答案 0 :(得分:1)

如果这是控制器中唯一的代码,您可以尝试从类顶部删除@RequestMapping注释吗?我认为这是多余的