Czarny Czarny - 3 months ago 27
reST (reStructuredText) Question

Path param gets null instead of value

I hava simple rest method looks like this

@RequestMapping(value = "/changePlan/{id}", method = RequestMethod.POST)
public void changePlan(@PathParam("id") String id) {
new Planner().changePlan(id);
}


Does anyone know why id in my case is null? When I've checked path from HttpServletRequest there actually is path changePlan/123456 but String id is still null

Answer

@PathParam isn't a Spring annotation. Use @PathVariable.

Comments