用jsp实现一个简单的购物车web应用系统(Using JSP to implement a simple shopping cart web application system).docVIP
- 21
- 0
- 约7.34千字
- 约 23页
- 2018-04-07 发布于江西
- 举报
用jsp实现一个简单的购物车web应用系统(Using JSP to implement a simple shopping cart web application system).doc
用jsp实现一个简单的购物车web应用系统(Using JSP to implement a simple shopping cart web application system)
1. in the establishment of their own WEB project, the establishment of packet shopcart.dto, in the corresponding package to add class Product.java, ShopCart.java
The 1./* class Product.
2.3.package shopcart.dto;
4.5.import java.io.Serializable;
6.7.public class Product implements Serializable
8.{
9. private String ID; / / String name private 10. product identification product name 11. private String; / / description; / / private double price 12. product description; / / public 13.14. Product (price)
15. {
16.}
17.18. public Product (String ID, String name, String description, double price)
19. {
20. this.id = id;
21. = name;
22. this.description = description;
23. this.price = price;
24.}
25.26. public void setId (String ID)
27. {
28. this.id = id;
29.}
30.31. public void setName (String name)
32. {
33. = name;
34.}
35.36. public void setDescription (String description)
37. {
38. this.description = description;
39.}
40.41. public void setPrice (double price)
42. {
43. this.price = price;
44.}
45.46. public String getId ()
47. {
48. return id;
49.}
50.51. public String getName ()
52. {
53. return name;
54.}
55.56. public String getDescription ()
57. {
58. return description;
59.}
60.61. public double getPrice ()
62. {
63. return price;
64.}
65.}
The 66./* class ShopCart.
67.68.package shopcart.dto;
69.70.import java.io.Serializable;
71.import java.util.*;
72.73.public class ShopCart implements Serializable
74.{
75. public ShopCart ()
76. {
77.}
78.79. private List cart = null;
80.81. / * *
82. * add a product to a shopping cart
83. * @param product Product
84..
85. public void addProductToCart (Product product)
86. {
87. if (CART = null)
88. cart = new ArrayList ();
89. Iterator it = cart.iterator ();
90. while (it.hasNext ())
91. {
92. Product item = (Product) it.next ();
93. if (item.getId ().Equals (product.getId ()))
94. {
95. return;
96.}
97.}
98. cart.add (product);
99
您可能关注的文档
- 浅论孟子的民本思想_论文.docx
- vb分数类和向量类之间运算程序(Arithmetic program between VB fractional class and vector class).doc
- 浅析冰心儿童散文的创作特色_论文.docx
- 安徽电子商务论文范文-试论ebuy购物系统的设计与实现论文.doc
- 宗教意识的链接与文学的选择 ——对中国现代文学传统的一种解读_论文.docx
- 公司春节联欢晚会方案 .docx
- 欧洲科技工业园区考察报告.doc
- 《羊脂球》读书心得体会.doc
- “德、言、容、功”的民间解读——论《陌上桑》的女性审美内涵.doc
- 我国城镇失业问题的成因及对策探讨_论文.docx
- 2025广东广州市天河区拟招聘英语实习老师1人备考题库附答案.docx
- 2025广东广州市天河区城市管理第二保洁所招聘编外工作人员4人笔试备考试卷附答案解析.docx
- 2025广东广州市越秀区流花街道办事处招聘综合事务中心辅助人员1人笔试历年题库附答案解析.docx
- 2025广东广州市花都区新雅街清初级中学招聘临聘教师1人备考历年题库带答案解析.docx
- 2025广东广州市天河区城市管理第二保洁所招聘编外工作人员4人笔试备考试卷带答案解析.docx
- 江苏省盐城市东台市三仓镇区中学2026届八年级数学第一学期期末教学质量检测试题含解析.doc
- 2025广东广州市天河区城市管理第二保洁所招聘编外工作人员4人备考题库带答案解析.docx
- 江苏省盐城市亭湖区2026届数学八上期末考试试题含解析.doc
- 安徽省蚌埠市淮上区2026届数学八年级第一学期期末达标检测模拟试题含解析.doc
- 2025广东广湛城旅游轮有限公司招聘备考历年题库附答案解析.docx
最近下载
- 一次函数竞赛试题0.doc VIP
- 公司经营班子会议议事规则.pdf VIP
- 2025年全国中考历史真题分类汇编.docx VIP
- 医用控温仪产品技术要求参考版.pdf
- 2025年中考历史全国真题分类汇编:世界现代史.doc VIP
- 14G443:预制带肋底板混凝土叠合楼板 .docx VIP
- 高考调频考点(圆锥曲线)7、椭圆、双曲线的坐标版焦半径公式.pdf VIP
- 2023年山东水利职业学院单招综合素质考试试题及答案解析.docx VIP
- 2023年山东水利职业学院单招考试综合素质模拟试题及答案解析.docx VIP
- 福建省宁德市2024-2025学年八年级上学期期末考试历史试题.pdf VIP
原创力文档

文档评论(0)