开发者

After calling URL "/article/1234abcd" how to retrieve the value `1234abcd` from inside the `article` action?

@RequestMapping(value 开发者_Go百科= "/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?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜