@RequestMapping("/user/checkout")
public String checkout(@SessionAttribute Map<String,Integer> shopcar ,
@SessionAttribute User user ,
HttpServletRequest request) throws Exception{
BookBiz biz = new BookBiz();
List<Book> books = bookBiz.getBookInfo(shopcar.keySet());
for(Book book:books) {
String value = request.getParameter(book.getISBN());
int bookCount = 1;
book.setByCount(1);
try {
if(value != null && !value.trim().equals("")) {
bookCount = Integer.parseInt(value);
book.setByCount(bookCount);
shopcar.put(book.getISBN(), bookCount);
}
} catch (Exception e) {
Log.logger.error("购买图书的数量应该为整数:" + e.getMessage());
}
}
double allMoney = 0;
for(Book bk:books) {
allMoney = allMoney + bk.getPrice() * bk.getByCount();
}
request.setAttribute("books", books);
request.setAttribute("user", user);
request.setAttribute("allMoney", allMoney);
return "main/Checkout.jsp";
}
<div class="container">
<div class="row">
<div class="order-inner gradient-brd">
<h4 itemprop="headline">您点的菜</h4>
<div class="order-list-wrapper">
<ul class="order-list-inner">
<li>
<c:forEach items="${menus}" var="bk">
<div class="dish-name">
<h6 itemprop="headline">${bk.mname}</h6> <span class="price">${bk.price}</span>
</div>
<div class="mor-ingredients">
<a class="red-clr" href="<%=basePath%>user/removeShopcar.do?id=${bk.id}">移除</a>
</div>
</c:forEach>
</li>
</ul>
<ul class="order-total">
<li><span>总计</span> <i>$27</i></li>
</ul>
<ul class="order-method brd-rd2 red-bg">
<li><a class="brd-rd2" href="#" title="" itemprop="url" onclick="check()">确认订单</a><a href="<%=basePath%>index.html" style="margin-left: 50px">返回</a></li>
</ul>
</div>
</div>
</div>
</div>
</div><!-- Section Box -->
</div>
你确定你发的是一个关联的东西??
一个图书一个菜
返回books,user,allMoney的值
去取menus的值