求修改或者给我JSP购物车代码

2025-02-26 15:01:02
推荐回答(1个)
回答1:

看看,能不能帮你:

<%@ page language="java" import="java.util.*" pageEncoding="gbk"%>




详细内容

<%
List list=(List)session.getAttribute("list");
int size=list.size();
int bookId=Integer.parseInt(request.getParameter("bookid"));
BookBean book=null;
int i=0;
while(i book=list.get(i);
if(bookId==book.getBookId())
{
session.setAttribute("bookToAdd",book);
break;
}
i++;
}
%>


书名;<%=book.getBookName() %>


价格:<%=book.getPrice() %>


描述:<%=book.getDescription() %>