I have simple spring controller.
@GetMapping("/test")
@ResponseBody
public String doSomething(@RequestParam int a) {
return String.valueOf(a);
}
when i pass a=1 in query string it works fine.
but when i pass a=abc it gave me this.
> Failed to convert value of type 'java.lang.String' to required type
> 'int'; nested exception is java.lang.NumberFormatException: For input
> string: "abc".
is there a way so i can handle this error and response back to user like a must be numeric.
thanks in advance.