本文主要是介绍网上书城的购物车功能(上),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
购物车功能
- 前言
- 购物车
- 所需的vo(实体类),web,xml配置
- vo(实体类)
- web
- xml配置
- 功能界面
- js样式
- index.jsp 购物车首页
- findBook.jsp 购物车搜索页面
- shopping.jsp 购物车界面
前言
之前修项目的时候经常图片加载不出来,是因为没有给图片做映射的结果,接下来是再卖给图片做映射的步骤,先在 Eclipse 中的Servers文件夹中找到server.xml,打开它滑到最底下找到这一行代码<Context docBase="mvc_book" path="/mvc_book" reloadable="true" source="org.eclipse.jst.jee.server:mvc_book"/>
在他的上面添加一行代码和修改下
<Context docBase="E:/temps/2020/mvc/upload/" path="/uploadImages" /><Context docBase="mvc_book" path="/" reloadable="true" source="org.eclipse.jst.jee.server:mvc_book"/>
界面结果
购物车
所需的vo(实体类),web,xml配置
vo(实体类)
展示
package com.tang.vo;import java.util.Objects;public class ShopGoodsVo {
// 购物车列表订单项所需数据private String name;private float price;private int num;private float total;// 提交订单所需数据private String consignee;private String phone;private String postalcode;private String address;private int sendType;// 页面的所有传参字符串private String pageStr;@Overridepublic boolean equals(Object o) {if (this == o) return true;if (o == null || getClass() != o.getClass()) return false;ShopGoodsVo that = (ShopGoodsVo) o;return Float.compare(that.price, price) == 0 &&num == that.num &&Float.compare(that.total, total) == 0 &&Objects.equals(name, that.name);}@Overridepublic int hashCode() {return Objects.hash(name, price, num, total);}public String getName() {return name;}public void setName(String name) {this.name = name;}public float getPrice() {return price;}public void setPrice(float price) {this.price = price;}public int getNum() {return num;}public void setNum(int num) {this.num = num;}public float getTotal() {return total;}public void setTotal(float total) {this.total = total;}public String getConsignee() {return consignee;}public void setConsignee(String consignee) {this.consignee = consignee;}public String getPhone() {return phone;}public void setPhone(String phone) {this.phone = phone;}public String getPostalcode() {return postalcode;}public void setPostalcode(String postalcode) {this.postalcode = postalcode;}public String getAddress() {return address;}public void setAddress(String address) {this.address = address;}public int getSendType() {return sendType;}public void setSendType(int sendType) {this.sendType = sendType;}public String getPageStr() {return pageStr;}public void setPageStr(String pageStr) {this.pageStr = pageStr;}@Overridepublic String toString() {return "ShopGoodsVo [name=" + name + ", price=" + price + ", num=" + num + ", total=" + total + ", consignee="+ consignee + ", phone=" + phone + ", postalcode=" + postalcode + ", address=" + address + ", sendType="+ sendType + ", pageStr=" + pageStr + "]";}public ShopGoodsVo(String name, float price, int num, float total, String consignee, String phone,String postalcode, String address, int sendType, String pageStr) {super();this.name = name;this.price = price;this.num = num;this.total = total;this.consignee = consignee;this.phone = phone;this.postalcode = postalcode;this.address = address;this.sendType = sendType;this.pageStr = pageStr;}public ShopGoodsVo() {super
这篇关于网上书城的购物车功能(上)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!