Closed
Description
Kenny MacLeod opened SPR-5237 and commented
From #8915:
Kenny MacLeod added a comment - 13/Dec/07 12:05 PM
Alternatively, perhaps @RequestParam
could take an optional "defaultValue" attribute? It'd have to be a string, subject to the same conversion rules as if the parameter had been present. This would work for primitives as well as reference types.
Connor Barry added a comment - 24/Oct/08 01:36 AM
I agree, a defaultValue attribute would be really helpful here, to mimic the set of functions in ServletRequestUtils that allow a default to be set if it's not present, for example:
ServletRequestUtils.getBooleanParameter(request, name, defaultVal)
Affects: 2.5 final
Issue Links:
- optional boolean @RequestParam fails on missing parameter [SPR-4237] #8915 optional boolean
@RequestParam
fails on missing parameter
Referenced from: commits 0012c1e