0
我要分配该对象($ {的categorys})到ArrayList的如何将EL值分配给一个变量在Java
这是JSP
<%
ArrayList<Category> al =${categorys};
%>
这是控制器
@RequestMapping(value = "/cat", method = RequestMethod.GET)
public ModelAndView getTrancationHistory() {
ArrayList<Category> allData = service.viewAllCategory();
//handle your code here...
System.out.println(allData);
for (Category allData1 : allData) {
System.out.println(allData1.getCategoryName());
}
ModelAndView modelAndView = new ModelAndView();
modelAndView.setViewName("WEB-INF/views/cat");
modelAndView.addObject("categorys", allData);
return modelAndView;
}