首页 > 代码库 > SpringMVC:JSON

SpringMVC:JSON

 

@ResponseBody
params="json":访问我这个方法的时候一定要有参数名为json
返回值User
jackson-all-1.9.0.jar
    @RequestMapping(value="http://www.mamicode.com/{nickname}",method=RequestMethod.GET,params="json")    @ResponseBody    public User show(@PathVariable String nickname){        System.out.println(nickname);        return users.get(nickname);    }

http://localhost:7070/SSM/user/lisi?json

 

技术分享

SpringMVC:JSON