基于MVC开发
步骤说明:
1、代码请参考——第一篇JDBC数据库之准备数据。
2、在第一篇基础上继续实现功能——第二篇JDBC数据库之查询数据。
以数据库中查找图书信息,并将信息显示在jsp页面当中为例,下面贴上代码片段:
一、准备数据库(详细请看第一篇)
二、创建实体类(Book.java)
1.与数据库对应的属性
2.设置setting和getterpackage com.entity;
/**
* Created by Ray on 2018/3/11 0011.
**/
public class Book {
private int id; //编号
private String name; //名称
private double price; //价格
private int bookCount; //数量
private String author; //作者
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
public int getBookCount() {
return bookCount;
}
public void setBookCount(int bookCount) {
this.bookCount = bookCount;
}
public String getAuthor() {
return author;</