Results 1 to 2 of 2

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

  1. #1
    Join Date
    Feb 2012
    Posts
    1

    Default 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. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,624

    Default

    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).
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •