`

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){
    });  
}
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics