整体思路
由JSP实现页面显示部分,Servlet主要用于处理客户端传来的Http请求,并返回一个响应,MySQL数据库负责存储表单生成所需要的数据,而JDBC负责与数据库建立联系。
首先在数据库中建立好信息表单,作为备调用的后台数据。
工程结构图示
根据数据表单,建立Profit类,实现setter(),getter()方法
Profit.java
package beans;
public class Profit {
private String name;
private int id;
private int costPrice;
private int sellPrice;
private String manufacturer;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getCostPrice() {
return costPrice;
}
public void setCostPrice(int costPrice) {
this.costPrice = costPrice;
}
public int getSellPrice() {
return sellPrice;
}
public void setSellPrice(int sellPrice) {
this.sellPrice = sellPrice;
}
public String getManufacturer() {
return manufacturer;
}
public void setManufact