Announcement Announcement Module
Collapse
No announcement yet.
Configuring default value for @RequestParam using property(or other configuration Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Configuring default value for @RequestParam using property(or other configuration

    Hi all,

    Is there a way to do this? for example, I have pagination parameters in my controller for eg

    @RequestMapping(...)
    public String myListMethod(@RequestParam("perPage", required=false, default="<some value from configuration>")int perPage, @RequestParam(...)int pageNumber) {...}

    where I set the default based on some configuration parameter dynamically (property file/database lookup etc).

  • #2
    You don't... I suggest using an object to encapsulate the properties (binding will be done automatically) and code the defaults in there (parameters that aren't send with the request aren't going to be overwritten).

    Comment

    Working...
    X