I have this rest controller method in springboot
@GetMapping("/cghsHcoSearchText/cityId/{cityId}/hcoName/{hcoName}/treatmentName/{treatmentName}")
public String cghsHcoSearchText(@PathVariable String cityId, @RequestParam(name = "hcoName", required = false) String hcoName,
@RequestParam(name = "treatmentName", required = false) String treatmentName) {
return "Some Text";
}
It has one PathVariable and 2 optional Request parameter.
Now when I hit this url with treatmentName = null i get Whitelabel Error Page
http://localhost:8082/cghs/cghsHcoSearchText/cityId/011?hcoName=Guru?
Any help will be appreciated.
/cghsHcoSearchText/cityId/{cityId}2. Your request URL ends with a question mark. There should only be one question mark in your URL - the one that separates the path from the parameter. Subsequent parameters have to be added using an ampersand (&)