?? notice.java
字號:
package nm;
import java.sql.ResultSet;
import java.util.Vector;
public class Notice implements java.io.Serializable{
int ID;
String title;
String content;
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public int getID() {
return ID;
}
public void setID(int id) {
ID = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public Notice() {
}
public Notice(String title, String content) {
this.title = title;
this.content = content;
}
public Notice(int ID, String title, String content) {
this.ID = ID;
this.title = title;
this.content = content;
}
public static Vector search(int pageSize, int page) throws Exception {
DB db = new DB(DBUtil.connectToDB());
Vector noticeVector = new Vector();
ResultSet rs = null;
String strSql = new String("SELECT * FROM noticemanager.Notice");
try {
rs = db.OpenSql(strSql);
Pageable pgb = new Pageable(rs);
pgb.setPageSize(pageSize);
pgb.gotoPage(page);
if(rs!=null){
rs.absolute(pgb.getRowsCount());
}
int i = 0;
int id = 0;
String title = null;
String content = null;
if(rs!=null&&!rs.wasNull()){
//System.out.print("瀛樺湪璁板綍");
do {
if(pgb.getCurrentPageRowsCount()!=0){
id = Integer.parseInt(rs.getString("ID"));
title = rs.getString("Title");
content = rs.getString("Content");
noticeVector.add(new Notice(id, title, content));
}
i++;
} while (rs.next() && i < pgb.getCurrentPageRowsCount());
return noticeVector;
} else{
System.out.print("涓嶅瓨鍦ㄨ
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -