Spring MVC控制层传递对象后在JSP页面中的取值方法

时间:2021-05-05 22:15:20
List<Order> orders = new ArrayList<Order>();
for (int i = 0; i < 3; i++) {
Order t = new Order(i, user_id, 1, "orderTime", "receiveName",
"fullAdress", "postalCode", "phone");
orders.add(t);
}
System.out.println("orders.size = " + orders.size());
Map model = new HashMap();
model.put("orders", orders);
model.put("user", user);
return new ModelAndView("UserOrder", model);

在jsp页面中使用jstl标签取出值以下自动循环取出每个值

<c:forEach items="orders" var="order">
原博主链接:http://blog.csdn.net/foxhlc/article/details/8785889