- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
用JSP和数据库做的购物车的源程序
用JSP和数据库做的购物车的源程序下面是我用JSP和数据库做的购物车的源程序://shop_cart.jsp<%@ page contentType=text/html;charset=gb2312%><%@ page session=true %><%@ page language=java import=java.sql.* %><jsp:useBean id=bka scope=page class=shop.bka /><%String product_type;String action;int product_id;int curpage;//商品类型if (request.getParameter(product_type)==null){product_type=all;}else{product_type=request.getParameter(product_type);}//页数和商品类型参数,可以在“继续购物”时返回到上次购物的页面if (request.getParameter(curpage)==null){curpage=1;}else{curpage=java.lang.Integer.parseInt(request.getParameter(curpage));}//动作if (request.getParameter(action)==null){action=view;}else{action=request.getParameter(action);}//商品编号if (request.getParameter(product_id)==null){product_id=0;}else{product_id=java.lang.Integer.parseInt(request.getParameter(product_id));}int bbb;bbb=1;Integer num = new Integer(bbb);//商店编号session.putValue(shop_id,num);//顾客usernamesession.putValue(guest_name,asp2001);String guest_name=(String)session.getValue(guest_name);Integer shop_id=(Integer)session.getValue(shop_id);java.lang.String sql;?java.sql.ResultSet rs;if (pareTo(add)==0) {sql=select cart_quantity from shop_cart where cart_shop_id=+ shop_id + and cart_guest_id= + guest_name + ?and cart_product_id= + product_id ;rs = bka.executeQuery(sql);if (rs.next()){int cart_quantity;cart_quantity=java.lang.Integer.parseInt(rs.getString(cart_quantity))+1;sql=update shop_cart set cart_quantity= + cart_quantity + where cart_shop_id= + shop_id + and cart_guest_id= +?guest_name + and cart_product_id= + product_id ;rs = bka.executeQuery(sql);}else{sql=insert into shop_cart (cart_shop_id,cart_guest_id,cart_product_id,cart_quantity) values ( + shop_id + ,?+ guest_name + , + product_id + ,1);rs = bka.executeQuery(sql);}}if (pareTo(clear)==0) {sql=delete from shop_cart where cart_shop_id= + shop_id + ?and cart_guest_id= + guest_name + ;rs = bka.executeQuery(sql);}if (pareTo(delete)==0) {?sql=delete from shop_cart where cart_shop_id= + shop_id + and cart_guest_id= + guest_nam
您可能关注的文档
- 第四讲 内核定制.ppt
- 2013 第1章_Linux系统概述.ppt
- AIX安装和配置.ppt
- 关於GridEx的操作.docx
- 数据库实验答案实验一Sql01.doc
- F660V5 2015 管理员权限及管理.docx
- 关于JDBC数据分页跨数据库小结.doc
- oracle管理.ppt
- 嵌入式系统设计与开发第2章 Linux基础1.ppt
- 四------环境部署之“IIS 与 Tomcat 整合配置”.docx
- DB43∕T 1805-2020 樟树低效林分改造技术规程.docx
- DB23∕T 2417-2019 住宅厨房和卫生间排气系统应用技术规程.docx
- DB61_T 1848-2024 地震预警信息发布规范.docx
- DB21T 2325-2014 猪传染性胃肠炎病毒RT-PCR检测方法.docx
- DB4105_T 231-2024 智能区域自动气象站建设规范.docx
- DB62_T 4879-2024 铃铛刺播种育苗及造林技术规程.docx
- DB4201_T 504-2017 武汉市地质灾害危险性评估技术规程.docx
- DB4201_T 537-2018 武汉市房屋安全鉴定技术规程.docx
- DB62_T 4524-2022 土壤环境背景值.docx
- DB53_T 977-2020 硅藻改性沥青混合料施工技术规范.docx
最近下载
- 2024年版中级经济师经济基础知识讲义.pdf VIP
- 大众接总线can线装车指南.pdf VIP
- 医院党委书记和院长定期沟通制度.doc VIP
- 机械CAD:CAM(UG)教案新模板(课次15)5-2 五角星的造型.doc VIP
- 2025年上海大剧院第三季度公开招聘笔试参考题库附答案解析.docx VIP
- 认真履行党员义务正确行使党员权利.doc VIP
- 校园安全主题班会课骑电动车.pptx VIP
- 西师大版数学四年级上册第三单元第1课时《线段、直线和射线》课件1.ppt VIP
- 福特 翼虎说明书.pdf VIP
- 火电企业档案分类表(6-9大类)(修订本)国家电力公司2002年度10月.pdf
文档评论(0)