value的uri值为以下三类:
A)
可以指定为普通的具体值;
B)
可以指定为含有某变量的一类值(URI Template Patterns with Path Variables);
@RequestMapping(value="/owners/{ownerId}", method=RequestMethod.GET) public String findOwner(@PathVariable String ownerId, Model model) { Owner owner = ownerService.findOwner(ownerId); model.addAttribute("owner", owner); return "displayOwner"; }
C)
可以指定为含正则表达式的一类值( URI Template Patterns with Regular Expressions);
@RequestMapping("/spring-web/{symbolicName:[a-z-]+}-{version:\d\.\d\.\d}.{extension:\.[a-z]}") public void handle(@PathVariable String version, @PathVariable String extension) { // ... } }
时间: 2024-10-20 00:34:43