( File view )

  • By 2010-09-02
  • View(s):14
  • Download(s):1
  • Point(s): 1
			package BookStore;

import java.util.*;
import java.sql.Connection;
import java.sql.ResultSet;

public class Book {
	private int id = 0;	
	private int catId = 0;	
	private String name = null;	
	private float price = 0;	
	private float salePrice = 0;	
	private String descript = null;
	private String author = null;	
	private String contents = null;	
	private String image = null;	
	public Book(){

	public void setId(int id) { = id;
	public int getId() {

		return id;
	public void setCatId(int catId) {

		this.catId = catId;
	public int getCatId() {

		return catId;
	public void setName(String name) { = name;
	public String getName() {

		return name;

	public void setPrice(float price) {

		this.price = price;
	public float getPrice() {

		return price;
	public void setSalePrice(float salePrice) {

		this.salePrice = salePrice;
	public float getSalePrice() {

		return salePrice;
	public void setDescript(String descript) {

		this.descript = descript;
	public String getDescript() {

		return descript;
	public void setAuthor(String author) { = author;
	public String getAuthor() {

		return author;
	public void setContents(String contents) {

		this.contents = contents;
	public String getContents() {

		return contents;
	public void setImage(String image) {

		this.image = image;
	public String getImage() {

		return image;
	public static Vector SearchBook(DB db,int mode,int bookCat,String field,String keyword) throws Exception{

		Vector bookList = new Vector();
		ResultSet rs;
        String strSql=null;
        String sField=null;
       if (mode==1 ) {

        	strSql = "select * from book where catid=" + bookCat;

        	if (field.equals("1")) sField="name";
        	else if(field.equals("2")) sField="author";
        	strSql = "select * from book where " + sField +" like '%" + keyword +"%' order by id";
/*        if (bookCat==0 ) {

        	strSql = "select * from book where 1=1 ";

        	strSql = "select * from book where catid=" + bookCat;
        if (keyword==null||keyword==""){

        	strSql = strSql + " order by id";

        	if (field.equals("1")) sField="name";
        	else if(field.equals("2")) sField="author";
        	strSql = strSql	+ " and " + sField +" like '%" + keyword +"%' order by id";
		rs = db.OpenSql(strSql);
		while  ({

			Book book = new Book();
			book.setId(rs.getInt("id")) ;
			book.setName(rs.getString("name")) ;
			book.setAuthor(rs.getString("author")) ;
			book.setPrice(rs.getInt("price")) ;
			book.setSalePrice(rs.getInt("saleprice")) ;
		System.out.println("bookList:        "+bookList.size());
		return bookList;

(Please download the complete source code to view)
Expand> <Close

Want complete source code? Download it here

Point(s): 1

0 lines left, continue to read
Sponsored links

File list

Tips: You can preview the content of files by clicking file names^_^
Name Size Date
bookMain.jsp4.13 kB15-04-06|12:00
bookShopCart.jsp6.35 kB15-04-06|12:04
bookShow.jsp3.27 kB15-04-06|12:03
jsp网上书店系统(毕业论文).doc314.50 kB16-05-08|12:22
orderAddress.jsp6.43 kB15-04-06|12:03
orderConfirm.jsp7.17 kB05-07-05|14:33
orderHistory.jsp4.44 kB15-04-06|12:03
userLogin.jsp2.89 kB08-03-09|10:49
userRegister.jsp5.15 kB21-04-09|08:31
wrong.jsp1.92 kB15-04-06|12:04
00-1.gif2.13 kB05-07-05|14:33
00-2.gif2.09 kB05-07-05|14:33
007.gif4.43 kB05-07-05|14:33
b10025.gif1.87 kB05-07-05|14:33
banner.gif19.33 kB05-07-05|14:33
book.gif84.00 B05-07-05|14:33
book00001.jpg3.70 kB05-07-05|14:33
book00002.jpg13.20 kB05-07-05|14:33
book800_005.gif2.20 kB05-07-05|14:33
book800_081.gif192.00 B05-07-05|14:33
book800_19_08.gif985.00 B05-07-05|14:33
bookTop.gif10.37 kB05-07-05|14:33
book_001.gif3.92 kB05-07-05|14:33
book_002.gif1.74 kB05-07-05|14:33
book_003.gif2.15 kB05-07-05|14:33
book_004.gif73.00 B05-07-05|14:33
book_005.gif721.00 B05-07-05|14:33
book_006.gif766.00 B05-07-05|14:33
book_007.gif726.00 B05-07-05|14:33
book_008.gif730.00 B05-07-05|14:33
book_011.gif1.91 kB05-07-05|14:33
book_012.gif689.00 B05-07-05|14:33
book_013.gif705.00 B05-07-05|14:33
book_020.gif2.31 kB05-07-05|14:33
book_026.gif565.00 B05-07-05|14:33
book_027.gif1.59 kB05-07-05|14:33
book_028.gif666.00 B05-07-05|14:33
book_029.gif2.33 kB05-07-05|14:33
book_032.gif690.00 B05-07-05|14:33
book_035.gif2.18 kB05-07-05|14:33
book_038.gif688.00 B05-07-05|14:33
book_039.gif1.99 kB05-07-05|14:33
book_040.gif1.46 kB05-07-05|14:33
book_041.gif63.00 B05-07-05|14:33
book_042.gif2.15 kB05-07-05|14:33
book_043.gif790.00 B05-07-05|14:33
book_046.gif4.62 kB05-07-05|14:33
book_bg2.gif197.00 B05-07-05|14:33
book_logo.gif1.31 kB05-07-05|14:33
button002.gif550.00 B05-07-05|14:33
button005.gif547.00 B05-07-05|14:33
kong.gif43.00 B05-07-05|14:33
new.css4.55 kB05-07-05|14:33
order.gif180.00 B05-07-05|14:33
pwd.gif311.00 B05-07-05|14:33
ruanjian.jpg133.71 kB05-07-05|14:33
spacer.gif43.00 B05-07-05|14:33
stars4.gif233.00 B05-07-05|14:33
style.css2.36 kB05-07-05|14:33
Thumbs.db101.00 kB16-05-08|13:19
ti1.gif774.00 B05-07-05|14:33
ti2.gif772.00 B05-07-05|14:33
view.gif386.00 B05-07-05|14:33
struts-bean.tld8.65 kB05-07-05|14:33
struts-config.xml5.19 kB05-07-05|14:33
struts-html.tld65.98 kB05-07-05|14:33
validation.xml2.12 kB05-07-05|14:33
validator-rules.xml11.97 kB05-07-05|14:33
web.xml696.00 B21-04-09|08:15
AddrConfirmAction.java2.89 kB05-07-05|14:33
Book.java4.52 kB05-07-05|14:33
BookBuyAction.java2.56 kB05-07-05|14:33
BookCat.java1.11 kB05-07-05|14:33
BookDetailAction.java1.47 kB05-07-05|14:33
BookSearchAction.java2.64 kB05-07-05|14:33
ClearShopCartAction.java1.24 kB05-07-05|14:33
Constants.java1.02 kB05-07-05|14:33
DB.java1.32 kB05-07-05|14:33
DetailAction.java1.50 kB05-07-05|14:33
FirstAction.java2.53 kB05-07-05|14:33
LoginAction.java1.95 kB05-07-05|14:33
MyRequestProcessor.java693.00 B05-07-05|14:33
MyResource_zh.properties955.00 B05-07-05|14:33
Order.java2.63 kB05-07-05|14:33
OrderDelAction.java1.97 kB05-07-05|14:33
OrderHistoryAction.java1.44 kB05-07-05|14:33
PageCtrlAction.java2.29 kB05-07-05|14:33
RegistAction.java2.16 kB05-07-05|14:33
SearchStatus.java1.22 kB05-07-05|14:33
ShopCart.java647.00 B05-07-05|14:33
ShopCartForm.java4.32 kB05-07-05|14:33
UpdateShopCartAction.java1.94 kB05-07-05|14:33
User.java2.20 kB05-07-05|14:33
AddrConfirmAction.class2.79 kB05-07-05|14:33
Book.class3.84 kB05-07-05|14:33
BookBuyAction.class2.64 kB05-07-05|14:33
BookCat.class1.32 kB05-07-05|14:33
BookDetailAction.class1.60 kB05-07-05|14:33
BookSearchAction.class2.49 kB05-07-05|14:33
ClearShopCartAction.class1.06 kB05-07-05|14:33
Constants.class995.00 B05-07-05|14:33
DB.class1.59 kB05-07-05|14:33
DetailAction.class1.63 kB05-07-05|14:33
LoginAction.class2.48 kB05-07-05|14:33
MyRequestProcessor.class708.00 B05-07-05|14:33
Order.class2.75 kB05-07-05|14:33
OrderDelAction.class2.24 kB05-07-05|14:33
OrderHistoryAction.class1.55 kB05-07-05|14:33
PageCtrlAction.class2.50 kB05-07-05|14:33
RegistAction.class2.14 kB05-07-05|14:33
SearchStatus.class1.32 kB05-07-05|14:33
ShopCart.class951.00 B05-07-05|14:33
UpdateShopCartAction.class1.61 kB05-07-05|14:33
User.class2.29 kB05-07-05|14:33
antlr.jar379.46 kB05-07-05|14:33
commons-beanutils.jar115.94 kB05-07-05|14:33
commons-collections.jar171.31 kB05-07-05|14:33
commons-digester.jar106.54 kB05-07-05|14:33
commons-fileupload.jar21.85 kB05-07-05|14:33
commons-logging.jar37.12 kB05-07-05|14:33
commons-validator.jar82.29 kB05-07-05|14:33
jakarta-oro.jar63.73 kB05-07-05|14:33
struts.jar514.24 kB05-07-05|14:33
BookStore0.00 B24-03-09|12:40
classes0.00 B24-03-09|12:40
lib0.00 B24-03-09|12:40
images0.00 B24-03-09|12:40
WEB-INF0.00 B24-03-09|12:40
bookstore0.00 B24-03-09|12:40
Sponsored links (1.76 MB)

Need 1 point
Your Point(s)

Your Point isn't enough.

Get point immediately by PayPal

More(Debit card / Credit card / PayPal Credit / Online Banking)

Submit your source codes. Get more point


Don't have an account? Register now
Need any help?
Mail to:


CodeForge Chinese Version
CodeForge English Version

Where are you going?

^_^"Oops ...

Sorry!This guy is mysterious, its blog hasn't been opened, try another, please!

Warm tip!

CodeForge to FavoriteFavorite by Ctrl+D