Results 1 to 2 of 2

Thread: RequestMapping value attribute as string array

  1. #1

    Default RequestMapping value attribute as string array

    Hi, is it possible to pass mapping paths as array? I tried this, but with no success:

    Code:
    private static final String[] COMMISSION_LIST =
    {"commissionList.htm", "openCommissionList.htm", "closeCommissionList.htm", "stornoCommissionList.htm"};
    
    ...
    
    @RequestMapping(value=COMMISSION_LIST, method=RequestMethod.GET)
    ... compiler says: incompatible types - found: String[], required: String

    but this works:

    Code:
    @RequestMapping(value={"commissionList.htm", "openCommissionList.htm", "closeCommissionList.htm", "stornoCommissionList.htm"}, method=RequestMethod.GET)
    Any idea how to get it work, please? (I know that I can use the latter code, but I need to use COMMISSION_LIST on few other places, so it should be less error prone if I can use array constant).

    Best regards, Pavla Novakova

  2. #2

    Default

    afaik, you can't include variables in an annotation

    http://darkforge.blogspot.com/2008/0...t-default.html

    but it would come in handy at times, perhaps someone has an example with a custom annotation?

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
  •