spring mvc json直输

<!-- json转换器 -->
<bean id="jsonConverter" class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter">
  <property name="supportedMediaTypes" value="application/json" />
</bean>


@Controller
@RequestMapping("task")
public class TaskControl { 
     @RequestMapping("getUserById") 
     @ResponseBody
     public List getUserById(Integer id) {
         return this.taskService.getUserById(id);
     } 
}


functon getUserById(id){
    $.getJSON("task/getUserById",{id:id},function(data){
    });  
}

猜你喜欢

转载自jis117.iteye.com/blog/1965266
今日推荐