資源簡介
JAVA web開發技術教程源碼 張娜主編 供同學們參考使用。
代碼片段和文件信息
package?book.bean;
import?java.sql.*;
import?java.util.*;
public?class?BookInfo?{
private?String?id;
private?String?bookname;
private?String?author;
private?String?price;
public?String?getBookname()?{
return?bookname;
}
public?void?setBookname(String?bookname)?{
this.bookname?=?bookname;
}
public?String?getAuthor()?{
return?author;
}
public?void?setAuthor(String?author)?{
this.author?=?author;
}
public?String?getPrice()?{
return?price;
}
public?void?setPrice(String?price)?{
this.price?=?price;
}
public?void?setId(String?id)?{
this.id?=?id;
}
public?String?getId()?{
return?id;
}
//返回所有圖書信息的方法
public?static?ArrayList?getBookList(){
ArrayList?list=new?ArrayList();
String?sql=“select?*?from?bookinfo“;
DBBean?jdbc=new?DBBean();
ResultSet?rs=jdbc.executeQuery(sql);
????????try?{
while(rs.next()){
BookInfo?bi=new?BookInfo();
bi.setId(rs.getString(“id“));
bi.setBookname(rs.getString(“bookname“));
bi.setAuthor(rs.getString(“author“));
bi.setPrice(rs.getString(“price“));
list.add(bi);
}
?rs.close();
}?catch?(SQLException?e)?{
e.printStackTrace();
}
????????jdbc.close();
????????return?list;
}
//返回單條圖書信息的方法
public?static?BookInfo?getBookById(String?id){
String?sql=“select?*?from?bookinfo?where?id=“+id;
DBBean?jdbc=new?DBBean();
ResultSet?rs=jdbc.executeQuery(sql);
BookInfo?bi=new?BookInfo();
????????try?{
if(rs.next()){
bi.setId(rs.getString(“id“));
bi.setBookname(rs.getString(“bookname“));
bi.setAuthor(rs.getString(“author“));
bi.setPrice(rs.getString(“price“));
}
?rs.close();
}?catch?(SQLException?e)?{
e.printStackTrace();
}
????????jdbc.close();
????????return?bi;
}
//修改某條圖書信息的方法
public?static?int?updateBook(String?idString?booknameString?authorString?price){
int?result=0;
String?sql=“update?bookinfo?set?bookname=‘“+bookname+“‘author=‘“+author+“‘price=“+price+“?where?id=“+id;
DBBean?jdbc=new?DBBean();
result=jdbc.executeUpdate(sql);
return?result;
}
//刪除某條圖書信息的方法
public?static?int?deleteBook(String?id){
int?result=0;
String?sql=“delete?from?bookinfo?where?id=“+id;
DBBean?jdbc=new?DBBean();
result=jdbc.executeUpdate(sql);
return?result;
}
//添加圖書信息的方法
public?static?int?addBook(String?booknameString?authorString?price){
int?result=0;
String?sql=“insert?into?bookinfo?values(null‘“+bookname+“‘‘“+author+“‘“+price+“)“;
DBBean?jdbc=new?DBBean();
result=jdbc.executeUpdate(sql);
return?result;
}
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????1222??2009-05-03?14:09??Java?Web開發技術教程源碼\書上代碼\ch14\.project
?????文件????????285??2009-05-02?12:20??Java?Web開發技術教程源碼\書上代碼\ch14\.myme
?????文件????????735??2009-05-11?08:17??Java?Web開發技術教程源碼\書上代碼\ch14\.classpath
?????文件????????478??2009-05-05?09:45??Java?Web開發技術教程源碼\書上代碼\ch14\WebRoot\header.jsp
?????文件???????1549??2009-05-07?09:37??Java?Web開發技術教程源碼\書上代碼\ch14\WebRoot\listAll.jsp
?????文件????????104??2009-05-04?17:28??Java?Web開發技術教程源碼\書上代碼\ch14\WebRoot\index.jsp
?????文件????????664??2009-05-05?09:23??Java?Web開發技術教程源碼\書上代碼\ch14\WebRoot\topList.jsp
?????文件???????1123??2009-05-07?09:38??Java?Web開發技術教程源碼\書上代碼\ch14\WebRoot\showFile.jsp
?????文件???????2246??2009-05-07?09:38??Java?Web開發技術教程源碼\書上代碼\ch14\WebRoot\sortList.jsp
?????文件???????2421??2009-05-07?09:38??Java?Web開發技術教程源碼\書上代碼\ch14\WebRoot\searchList.jsp
?????文件???????1227??2009-05-05?11:08??Java?Web開發技術教程源碼\書上代碼\ch14\WebRoot\admin\login.jsp
?????文件???????2177??2009-05-04?12:01??Java?Web開發技術教程源碼\書上代碼\ch14\WebRoot\admin\add.jsp
?????文件????????135??2009-05-04?12:46??Java?Web開發技術教程源碼\書上代碼\ch14\WebRoot\admin\result.jsp
?????文件???????1785??2009-05-05?09:25??Java?Web開發技術教程源碼\書上代碼\ch14\WebRoot\admin\list.jsp
?????文件???????2812??2009-05-07?09:37??Java?Web開發技術教程源碼\書上代碼\ch14\WebRoot\admin\update.jsp
?????文件?????????39??2009-05-02?12:20??Java?Web開發技術教程源碼\書上代碼\ch14\WebRoot\me
?????文件???????1493??2009-05-07?09:37??Java?Web開發技術教程源碼\書上代碼\ch14\WebRoot\WEB-INF\web.xm
?????文件???????2226??2009-05-11?08:17??Java?Web開發技術教程源碼\書上代碼\ch14\WebRoot\WEB-INF\classes\service\UserService.class
?????文件????????925??2009-05-11?08:17??Java?Web開發技術教程源碼\書上代碼\ch14\WebRoot\WEB-INF\classes\service\CommonService.class
?????文件???????2740??2009-05-11?08:17??Java?Web開發技術教程源碼\書上代碼\ch14\WebRoot\WEB-INF\classes\service\AdminService.class
?????文件???????3084??2009-05-11?08:17??Java?Web開發技術教程源碼\書上代碼\ch14\WebRoot\WEB-INF\classes\servlets\UserServlet.class
?????文件???????1828??2009-05-11?08:17??Java?Web開發技術教程源碼\書上代碼\ch14\WebRoot\WEB-INF\classes\servlets\LoginServlet.class
?????文件???????1492??2009-05-11?08:17??Java?Web開發技術教程源碼\書上代碼\ch14\WebRoot\WEB-INF\classes\servlets\DownLoadServlet.class
?????文件???????3681??2009-05-11?08:17??Java?Web開發技術教程源碼\書上代碼\ch14\WebRoot\WEB-INF\classes\servlets\AdminServlet.class
?????文件???????1418??2009-05-11?08:17??Java?Web開發技術教程源碼\書上代碼\ch14\WebRoot\WEB-INF\classes\util\PageBean.class
?????文件???????5965??2009-05-11?08:17??Java?Web開發技術教程源碼\書上代碼\ch14\WebRoot\WEB-INF\classes\util\FileUtil.class
?????文件???????5001??2009-05-11?08:17??Java?Web開發技術教程源碼\書上代碼\ch14\WebRoot\WEB-INF\classes\util\DBUtil.class
?????文件??????21195??2009-05-02?12:20??Java?Web開發技術教程源碼\書上代碼\ch14\WebRoot\WEB-INF\lib\jstl.jar
?????文件?????394583??2009-05-02?12:20??Java?Web開發技術教程源碼\書上代碼\ch14\WebRoot\WEB-INF\lib\standard.jar
?????文件??????57779??2009-05-02?16:14??Java?Web開發技術教程源碼\書上代碼\ch14\WebRoot\WEB-INF\lib\commons-fileupload-1.2.1.jar
............此處省略143個文件信息
評論
共有 條評論