Use Integer instead of int . If it is not installed, it will be zero.
If, for example, 0 is not a valid ID value, you can also leave it as an int and use
@RequestParam(value = "id", defaultValue = "0")
The parameter will be 0 if it did not pass.
Jb nizet
source share