spring mvc 必须传某个参数的写法

时间:2015-05-19 12:15:21   收藏:0   阅读:121

在controller中写 @RequestMapping(中的params="json")

    @RequestMapping(value = "/{username}", params = "json")
    @ResponseBody
    public User showJson(@PathVariable String username, Model model) {
        return users.get(username);
    }

 

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!