图书管理后台javabean
时间: 2024-06-13 10:09:06 浏览: 64
JavaBean是Java语言中一种特殊的类,它具有无参构造函数,属性私有,提供getter和setter方法,可以被其他Java程序复用。在图书管理后台中,JavaBean可以用来表示图书信息,例如书籍ISBN编号、书名、作者、价格、出版时间、折扣、库存量等信息。JavaBean可以通过JSP和Servlet进行交互,实现图书信息的添加、修改、删除和查询等功能。
下面是一个简单的图书信息JavaBean的示例代码:
```java
public class Book {
private String isbn;
private String name;
private String author;
private double price;
private Date publishDate;
private double discount;
private int stock;
public Book() {}
public String getIsbn() {
return isbn;
}
public void setIsbn(String isbn) {
this.isbn = isbn;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
public Date getPublishDate() {
return publishDate;
}
public void setPublishDate(Date publishDate) {
this.publishDate = publishDate;
}
public double getDiscount() {
return discount;
}
public void setDiscount(double discount) {
this.discount = discount;
}
public int getStock() {
return stock;
}
public void setStock(int stock) {
this.stock = stock;
}
}
```
阅读全文