@RequestMapping(value = "/{Id}", method = RequestMethod.GET)
public String searchCity( @PathVariable ("Id") Long Id) {
mymethod.something(id);
return "successpage";
}
当我正在尝试写一些数字时,它打印我Eror 404资源不可用,但是当我写{Id}(“7DId7D”这样的东西)时,它将我重定向到succespage,有什么问题?请帮帮我......
答案 0 :(得分:2)
您提供的信息与Spring MVC的已知行为相冲突
http://localhost:8080/MyCountryProject/7
应该映射到searchCity fine http://localhost:8080/MyCountryProject/%7Bld%7D
甚至不应映射到searchCity 我会检查以下内容以进一步隔离问题:
@RequestMapping("myController")
,那么您的网址将为http://localhost:8080/MyCountryProject/MyController/7