0
@RequestMapping(value = "/article", method = RequestMethod.GET)
public final String article(final ModelMap model)
{
}

If this is called using the address:

/article/1234abcd

How can the value 1234abcd be retrieved from inside the article method?

Cornish
  • 899
  • 2
  • 9
  • 8

1 Answers1

3

By using @PathVariable:

@RequestMapping(value = "/article/{articleId}", method = RequestMethod.GET)
public final String article(final ModelMap model, @PathVariable String articleId)
{
}

See Spring docs for more info.

skaffman
  • 398,947
  • 96
  • 818
  • 769