I have a arraylist returned from my controller to jsp, now I want to use that arraylist to populate the datatable. This is what I have done, but it is not working:
$(document).ready(function() {
//grpAlphaInfoVO is the arraylist returned by my controller
$('#groupAlphaList').dataTable({
"aaData": "${grpAlphaInfoVO}"
});
});
This is my controller code:
@RequestMapping(value = "/groupAlpha/search/{groupName}", method = { RequestMethod.GET, RequestMethod.POST })
public ModelAndView groupAlphaHandler(@PathVariable("groupName") String groupName, HttpServletRequest request) {
ArrayList<GroupAlphaInfoVO> grpAlphaInfoVO = groupAlphaService.loadGroupAlphaSearchResult(groupName);
if(grpAlphaInfoVO != null) {
ModelAndView mav = new ModelAndView("group-alpha");
mav.addObject("grpAlphaInfoVO", grpAlphaInfoVO);
mav.addObject("pageTitle", "Group Alpha");
return mav;
}
}