How to send % using @RequestParam in Spring ?
%
@RequestParam
I'm calling the API by this URL : http://localhost:8080/springmvc/test?param1=%
http://localhost:8080/springmvc/test?param1=%
But I'm not able to get the % in the API. When I'm debugging, I'm getting param1 = null but I want to get the real character %. How to get that ?
param1 = null
This is my API :
public List<Test> testParam( @PathVariable("test") string test, @RequestParam(value = "param1", required = false) string myParaml) { ... }
You have to send special characters in UTF-8 encoded standard in the URL.
Try to send % as %25, which is UTF-8 encoded equivalent.
%25
http://localhost:8080/springmvc/test?param1=%25
This will work. Refer here for more.
2.1m questions
2.1m answers
60 comments
57.0k users