호출 Ajax에서 ModelAndView를 반환하면 정상적으로 jsp 페이지가 표시되고 다른 개체와지도로 반환하면 작동하지 않습니다.ajax 호출에서 ModelAndView를 반환하는 차이점
첫 번째 경우 어떤 일 :
@RequestMapping(value="/searchlostcard")
public @ResponseBody
ModelAndView searchlostcard() {
[...]
return new ModelAndView("search/results","cardlist", listlostcard); ;
}
내 아약스 호출
[...]
success : function(responce) {
$('#page_grid').html(responce);
}
두 번째 경우 작동하지 않습니다
@RequestMapping(value="/searchlostcard")
public @ResponseBody
Map<String, Object> searchlostcard() {
[...]
ModelAndView MaV = new ModelAndView("search/results","cardlist", listlostcard);
Map<String, Object> modelino = new HashMap<String, Object>();
modelino.put("taille", listlostcard.size());
modelino.put("vue", MaV);
return modelino ;
}
내 아약스 호출
[...]
success : function(responce) {
$('#page_grid').html(responce['vue']);
}
,
왜 ModelAndView를 모델 맵에 넣을까요? ModelAndView 객체로 클라이언트가해야 할 일은 무엇입니까? –
모델지도에 넣지 않았습니다.보기에 다른 개체를 보내기 위해지도에 넣었습니다. – Youssef