Spring MVC /Roo - Request method 'GET' not

2019-09-14 23:10发布

问题:

@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";
}

Why does this give me HTTP Status 405 - Request method 'GET' not supported on url: http://localhost:8080/twiter-roo/tusers/1 ?

回答1:

If that is the only code in the controller, can you try and remove the @RequestMapping annotation from the top of the class? I think it is redundant