springMVC3使用@ResponseBody返回json

所需jar包:

下载地址: jackson-core-asl-1.9.7.jar包

 
        
            
                
                
            
        
    

        
            
                
                
            
        
    

使用@ResponseBody的方法

@RequestMapping("/json")
    @ResponseBody
    public Map json(){
        Map map=new HashMap<>();
        map.put("hello","json");
        map.put("springMVC","responseBody");
        return map;
    }


你可能感兴趣的:(SpringMVC)