Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 31st, 2012  |  syntax: None  |  size: 0.94 KB  |  hits: 14  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. springmvc @RequestMapping The following two urls How to exact match?
  2. @RequestMapping("/{c1}-{c2}-{c3}-{c4}.htm")
  3. public void category(@PathVariable("c1") Integer c1,@PathVariable("c2") Integer c2,@PathVariable("c3") Integer c3,@PathVariable("c4") Integer c4){
  4.     System.out.println(c1);
  5.     System.out.println(c2);
  6.     System.out.println(c3);
  7.     System.out.println(c4);
  8. }
  9.  
  10. @RequestMapping("/{c1}-{c2}-{c3}-{c4}-{label}.htm")
  11. public void label(
  12.         @PathVariable("c1") Integer c1,
  13.         @PathVariable("c2") Integer c2,
  14.         @PathVariable("c3") Integer c3,
  15.         @PathVariable("c4") Integer c4,
  16.         @PathVariable("label") Integer label){
  17.     System.out.println(c1);
  18.     System.out.println(c2);
  19.     System.out.println(c3);
  20.     System.out.println(c4);
  21.     System.out.println(label);
  22. }
  23.        
  24. @RequestMapping("/{c1:[0-9]+}-{c2:[0-9]+}-{c3:[0-9]+}-{c4:[0-9]+}.htm")
  25. ...
  26. @RequestMapping("/{c1:[0-9]+}-{c2:[0-9]+}-{c3:[0-9]+}-{c4:[0-9]+}-{label}.htm")