struts实例代码 入门的比如二级联表,分页呀等,希望那个高手大哥给点学习

来源:百度知道 编辑:UC知道 时间:2024/05/15 16:54:51
一些简单的经典代码,
有分的呀!

三 分页实例代码
1 Book.java

package bean;
import java.sql.*;
import java.util.ArrayList;
/**
* Struts分页显示数据Bean,对应数据库中Book表
*/
public class Book {
private String bookname; //书名
private String author; //作者
private String price; //价格

public Book(String name,String author,String price){
this.bookname=name;
this.author=author;
this.price=price;
}

public String getAuthor() {
return author;
}

public void setAuthor(String author) {
this.author = author;
}

public String getBookname() {
return bookname;
}

public void setBookname(String bookname) {
this.bookname = bookname;
}

public String getPrice(){
return this.price;
}

public void setPrice(String price){
this.price=price;
}

public static ArrayList getAllBook(Connection connection){
String sql="select * from book