我定义了一个控制器,使用:
@Controller
@RequestMapping("/")
public class HomePageController {
@RequestMapping(method = RequestMethod.GET)
public String home(@RequestParam(value = "logout", defaultValue = "false") final boolean logout, final Model model, final RedirectAttributes redirectModel, final HttpServletRequest request, final HttpServletResponse response) {
System.out.println("testing");return "homepage";
}
该控件甚至不会访问此处定义的home方法并给出响应:
HTTP状态404 -未找到
但是,当我将请求Map更改为@RequestMapping("/test")
时,我能够在上面定义的home方法中获得控制权。
当请求Map用“/"定义时,为什么我不能点击控制器?我需要根URL来登录主页。
1条答案
按热度按时间qhhrdooz1#
试试这个
删除HomePageController上面的
@RequestMapping("/")
,并添加上面的特定方法签名,如下所示应该行得通!