-
大小: 4.07MB文件類型: .rar金幣: 2下載: 0 次發(fā)布日期: 2023-09-18
- 語(yǔ)言: 數(shù)據(jù)庫(kù)
- 標(biāo)簽: jsf??增刪改查??
資源簡(jiǎn)介
基于jsf框架的CRUD操作,帶oracle數(shù)據(jù)庫(kù)

代碼片段和文件信息
package?com.jsfTest.bean;
import?java.util.List;
import?javax.faces.component.html.HtmlDataTable;
import?javax.faces.context.FacesContext;
import?com.jsfTest.dao.BookDao;
import?com.jsfTest.pojo.Book;
public?class?BookBean?{
//變量名稱
private?Book?book;
private?List?list;
private?String?message;
private?HtmlDataTable?dataTable?=?new?HtmlDataTable();
BookDao?bdao=new?BookDao();
/**
?*?set()/get()
?*?@return
?*/
public?String?getMessage()?{
return?message;
}
public?List?getList()?{
return?list;
}
public?void?setList(List?list)?{
this.list?=?list;
}
public?void?setMessage(String?message)?{
this.message?=?message;
}
public?Book?getBook()?{
return?book;
}
public?void?setBook(Book?book)?{
this.book?=?book;
}
public?HtmlDataTable?getDataTable()?{
return?dataTable;
}
public?void?setDataTable(HtmlDataTable?dataTable)?{
this.dataTable?=?dataTable;
}
/**
?*?顯示所有的書(shū)籍
?*/
public?String?showList(){
this.setBook(new?Book());
list=bdao.findBooks(this.book.getBookname());
dataTable.setValue(list);
if(list.size()==0){
message=“暫無(wú)數(shù)據(jù)!“;
}
return?“show“;
}
/**
?*?添加書(shū)籍
?*/
public?String?preAdd(){
this.setBook(new?Book());
return?“add“;
}
public?String?add(){
boolean?flag=bdao.addBook(this.getBook());
if(flag){
message=“添加成功“;
}else{
message=“添加失敗“;
}
this.setBook(new?Book());
return?“addOk“;
}
/**
?*?刪除書(shū)籍
?*/
public?String?del(){
FacesContext?context?=?FacesContext.getCurrentInstance();
????Integer?bookid?=?Integer.parseInt((String)?context.getExternalContext().getRequestParameterMap().get(“bookid“));
boolean?flag=bdao.delBook(bookid);
if(flag){
message=“刪除成功“;
}else{
message=“刪除失敗“;
}
this.setBook(new?Book());
showList();
return?“deleteOk“;
}
/**
?*?編輯書(shū)籍
?*/
public?String?preEdit(){
FacesContext?context?=?FacesContext.getCurrentInstance();
????Integer?bookid?=?Integer.parseInt((String)?context.getExternalContext().getRequestParameterMap().get(“bookid“));
book=bdao.getBook(bookid);
return?“edit“;
}
/**
?*?修改書(shū)籍
?*/
public?String?update(){
boolean?flag=bdao.updateBook(book);
if(flag){
message=“修改成功“;
}else{
message=“修改失敗“;
}
this.setBook(new?Book());
showList();
return?“updateOk“;
}
}
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件???????1033??2011-06-13?14:41??jsfTest\.classpath
?????文件????????294??2011-06-13?11:58??jsfTest\.myme
?????文件???????1413??2011-06-13?13:43??jsfTest\.project
?????文件????????500??2011-06-13?11:58??jsfTest\.settings\.jsdtscope
?????文件????????330??2011-06-13?11:58??jsfTest\.settings\org.eclipse.jdt.core.prefs
?????文件?????????49??2011-06-13?11:58??jsfTest\.settings\org.eclipse.wst.jsdt.ui.superType.container
?????文件??????????6??2011-06-13?11:58??jsfTest\.settings\org.eclipse.wst.jsdt.ui.superType.name
?????文件???????2469??2011-06-17?11:45??jsfTest\src\com\jsfTest\bean\BookBean.java
?????文件???????2922??2011-06-17?11:43??jsfTest\src\com\jsfTest\dao\BookDao.java
?????文件????????881??2011-06-17?10:40??jsfTest\src\com\jsfTest\pojo\Book.java
?????文件???????1577??2011-06-17?11:32??jsfTest\src\com\jsfTest\util\ConnectionUtil.java
?????文件???????1926??2011-06-17?16:13??jsfTest\WebRoot\add.jsp
?????文件????????383??2011-06-14?16:48??jsfTest\WebRoot\css\st
?????文件???????4096??2011-06-17?16:18??jsfTest\WebRoot\databa
?????文件???????2012??2011-06-17?16:01??jsfTest\WebRoot\edit.jsp
?????文件???????1043??2011-06-17?15:57??jsfTest\WebRoot\images\datePicker.gif
?????文件????????451??2011-06-17?10:42??jsfTest\WebRoot\index.jsp
?????文件????????509??2011-06-15?10:16??jsfTest\WebRoot\js\book.js
?????文件??????15361??2011-06-17?15:41??jsfTest\WebRoot\js\calendar.js
?????文件?????????36??2011-06-13?11:57??jsfTest\WebRoot\me
?????文件???????2248??2011-06-17?10:48??jsfTest\WebRoot\show.jsp
?????文件????????738??2011-06-17?13:36??jsfTest\WebRoot\WEB-INF\beans.xm
?????文件???????3813??2011-06-17?11:45??jsfTest\WebRoot\WEB-INF\classes\com\jsfTest\bean\BookBean.class
?????文件???????4289??2011-06-17?11:43??jsfTest\WebRoot\WEB-INF\classes\com\jsfTest\dao\BookDao.class
?????文件???????1417??2011-06-17?10:40??jsfTest\WebRoot\WEB-INF\classes\com\jsfTest\pojo\Book.class
?????文件???????1970??2011-06-17?11:32??jsfTest\WebRoot\WEB-INF\classes\com\jsfTest\util\ConnectionUtil.class
?????文件?????188671??2011-06-09?13:46??jsfTest\WebRoot\WEB-INF\lib\commons-beanutils.jar
?????文件?????559366??2011-06-09?13:46??jsfTest\WebRoot\WEB-INF\lib\commons-collections.jar
?????文件?????168446??2011-06-09?13:46??jsfTest\WebRoot\WEB-INF\lib\commons-digester.jar
?????文件?????245274??2011-06-10?15:00??jsfTest\WebRoot\WEB-INF\lib\commons-lang-2.3.jar
............此處省略35個(gè)文件信息
評(píng)論
共有 條評(píng)論