기본 콘텐츠로 건너뛰기

6월, 2011의 게시물 표시

Laguna Beach 드라이브

오늘 오후에 잠깐 집 근처의 라구나 비치 구경을 다녀왔습니다. 기록도 할 겸 사진 몇장 올려봅니다.

Spring3에서 @RequestMapping시 URI tempate이 제대로 먹히지 않는 경우

@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"; }The URI Template "/owners/{ownerId}" specifies the variable name ownerId. When the controller handles this request, the value of ownerId is set to the value in the request URI. For example, when a request comes in for /owners/fred, the value fred is bound to the method parameter String ownerId.

The matching of method parameter names to URI Template variable names can only be done if your code is compiled with debugging enabled. If you do not have debugging enabled, you must specify the name of the URI Template variable name in the @PathVariable annotation in order to bind the resolved value of the variable name to a method parameter.

http://static.springsource.org/spring/docs/current/spring-frame…