WebContent/cart_add.jsp

(完整代码) 954B

<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<%@ page import="java.util.*"%>
<%@ page import="com.wy.domain.SellGoodsForm"%>
<%
int goodsID=Integer.parseInt(request.getParameter("goodsId"));
float goodsPrice=Float.parseFloat(request.getParameter("price"));
SellGoodsForm sellGoodsForm=new SellGoodsForm();
sellGoodsForm.ID=goodsID;
sellGoodsForm.price=goodsPrice;
sellGoodsForm.number=1;
boolean flag=true;
Vector cart=(Vector)session.getAttribute("cart");
if(cart==null){
cart=new Vector();
}else{
for(int i=0;i<cart.size();i++){
   SellGoodsForm form=(SellGoodsForm)cart.elementAt(i);
   if(form.ID==sellGoodsForm.ID){
     form.number++;
     cart.setElementAt(form,i);
     flag=false;

   }
}
}
if(flag)
cart.add(sellGoodsForm);
session.setAttribute("cart",cart);

out.println("<script language='javascript'>alert('购买商品成功!');window.close();</script>");
%>

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。