把購物車里面選中的商品 添加到到訂單表里
購物車是<c:forEach items="${goodscar }" var="goodscar"></c:forEach>回圈出來的
jsp
function orderform (){
//
var a="";
$(".danchecked:checked").parent().prev().each(function(i){
a+=$(this).text()+",";
})
document.location="Selectsite?id="+ a;
}
servlet
String goodcarid = request.getParameter("id");
int a=0;
String[] arry = goodcarid.split(",");
for(int i = 0;i<arry.length;i++) {
a=Integer.parseInt(arry[i]);
//物體類
Orders orders = new Orders(0, 0, 0, a, usernumber, time, "");
//呼叫存入的方法
ines.addorder(orders);
}
獲取選中的id 然后用逗號分開了 在servlet 根據逗號拆分回圈得到id 但是存不進去 可能這種方法行不通,我該怎么存進去呢 請大佬幫幫忙
轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/99876.html
標籤:其他
下一篇:stomp的ack幀如何接收
