【发布时间】:2018-09-14 04:10:12
【问题描述】:
我需要从这个网址开始,http://localhost:8080/home/filter?projectId=1;fileId=1
我创建了这个控制器:
@GetMapping("/home/filter/{projectId}/{fileId}")
public String filter(@PathVariable("projectId") int projectId, @PathVariable("fileId") int fileId) {
System.out.println("Project Id " + projectId);
System.out.println("File Id " + fileId);
return "redirect:/home";
}
当我测试时:http://localhost:8080/home/filter?projectId=1;fileId=1 我收到此错误:
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Wed Apr 04 17:24:51 EEST 2018
There was an unexpected error (type=Not Found, status=404).
/home/filter
我不知道该怎么办..
【问题讨论】:
-
如果您使用的是 spring boot,那么您肯定正在执行其中之一,请在此处查看。stackoverflow.com/questions/49375500/…
-
提示:
/home/filter?projectId=1;fileId=1格式不同于/home/filter/{projectId}/{fileId} -
必须是这样的:/home/filter{projectId}{fileId} ??
标签: java spring spring-mvc thymeleaf