Skip to content

Default value for @RequestParam [SPR-5237] #9911

Closed
@spring-projects-issues

Description

@spring-projects-issues

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:

Referenced from: commits 0012c1e

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions