AdminController.java
@RequestMapping(value="show_allMember.do",produces = MediaType.APPLICATION_JSON_UTF8_VALUE,method = RequestMethod.POST)
public @ResponseBody String memberList(ModelAndView mav)
{
List<HashMap<String, Object>> members = aService.getMemberList();
mav.addObject("mList",members);
System.out.println("model is that : " + mav);
return "" + mav ;
}
adminMainPage.jsp
function show_allMember()
{
$('.member_management_area').css('display','block');
$('.member_management').css('color','#fe4978');
$.ajax
({
type: 'POST',
url: 'http://localhost:8080/rachelivf/show_allMember.do',
dataType:'JSON',
success: function(mList)
{
console.log(mList);
$.each(response.mList, function(index, value)
{
console.log(response.list);
});
},
error: function(xhr,ajaxOptions,thrownError)
{
if(xhr.status == 404)
{
alert(thrownError);
}
}
});
}
I tried to find the way. But it failed.
I want to get the values of the model returned from the controller in ajax and display it in jsp.
But I don't know how.
As a beginner, I do not know much, so I ask a lot of questions. Please let me know if I have provided the information properly. Please let me know if the gist of the question is wrong. I need your opinion.