在我的客户端,我使用ajax向Spring控制器发送请求。这最后一个可以拦截它,但是当我返回一个值时,我不能在我的客户端拥有它。
客户代码:
$.ajax({
type: "GET",
data: {name : "name"},
url: "/web/private/frontend/accueil/dateHistorique.html",
success: function(msg){
alert("Hello");
}
});
服务器端代码:
@RequestMapping(value="/dateHistorique.html", method = RequestMethod.GET)
public @ResponseBody Map<String, String> getAllowedDate(@RequestParam String name) {
System.out.println("***********************************" + name);
AllowedDates allowedDates = new AllowedDates("1","20");
Map<String, String> responseMap = new HashMap<String, String>();
responseMap.put("Name", "Marouane");
return responseMap;
}
我可以在服务器中看到输出: * ** * *** *名称但始终没有响应。 日Thnx
答案 0 :(得分:0)
应该将Jackson
添加到我的pom,将<mvc:annotation-driven />
添加到我的mvc-servlet-context