仅在方法中使用@ResponseBody注释就足够了。这将解决您的问题。
@RequestMapping(value = "/android/api/home", method = RequestMethod.GET, produces=MediaType.APPLICATION_JSON_VALUE)public @ResponseBody void Home(Locale locale, Model model,HttpServletRequest request,HttpServletResponse response) throws IOException { //your logic}
在ajax调用中添加内容类型
jQuery .ajax({ url : controllerUrl, data: oMyForm, dataType : 'text', processdata: false, contentType : false, type : 'POST', success : function(data) { } });
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)