PathVariable в Spring Controller

Я пытаюсь отобразить url /locations/{locationId}/edit.html - это вроде работает с этим кодом:

@Controller
@RequestMapping( "/locations" )
public class LocationController
{
  @RequestMapping( value = "/{locationId}/edit.html", method = RequestMethod.GET )
  public String showEditForm( Map<String, Object> map, @PathVariable int locationId )
  {
    map.put( "locationId", locationId );
    return "locationform";
  }
}

Вызов указанного url приводит к исключению:

java.lang.IllegalArgumentException: Name for argument type [int] not available, and parameter name information not found in class file either.

Я неправильно использую аннотацию @PathVariable?

Как правильно ее использовать?

23
задан dtrunk 31 January 2012 в 10:19
поделиться