After calling URL “/article/1234abcd” how to retrieve the value `1234abcd` from inside the `article` action?
-
01-10-2019 - |
Pergunta
@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?
Solução
By using @PathVariable
:
@RequestMapping(value = "/article/{articleId}", method = RequestMethod.GET)
public final String article(final ModelMap model, @PathVariable String articleId)
{
}
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow