Spring Boot出现错误,它说我不发送./bin/hdfs ec -disablePolicy -policy XOR-2-1-1024k
,但它是错误的,我发送了paramSelect。
我发送
paramSelect
HTML错误->
public filterResult(paramSelect: string, filterDateStart: string, filterDateEnd: string): Observable<any> {
filterDateStart = filterDateStart.replace(/\//g, '-');
filterDateEnd = filterDateEnd.replace(/\//g, '-');
const url = 'http://localhost:8080/filterResult/' + paramSelect + '/' + filterDateStart + '/' + filterDateEnd;
return this.http.get<any>(url);
在我的SpringBoot中->
zone.js:2969 GET http://localhost:8080/filterResult/EDU/04-07-2018/05-07-2018 400 ()
最后我得到一个错误->
@RequestMapping(method = RequestMethod.GET, value = "/filterResult/{paramSelect}/{dateStart}/{dateEnd}", produces = MediaType.APPLICATION_JSON_VALUE)
public List filterResult(@RequestParam("paramSelect") String paramSelect , @RequestParam("dateStart") String dateStart , @RequestParam("dateEnd") String dateEnd) {
System.out.println("llego");
List<Parameter> list = pgService.filterResult(paramSelect, dateStart, dateEnd);
return list;
}
我不明白为什么会收到此错误
答案 0 :(得分:3)
对于 path 变量,您应该更改为使用@PathVariable而不是@RequestParam
:
public List filterResult(@PathVariable("paramSelect") String paramSelect , @PathVariable("dateStart") String dateStart , @PathVariable("dateEnd") String dateEnd) {