• 大小: 4.14MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-10-21
  • 语言: Java
  • 标签: 网上书店  javaweb  mvc  

资源简介

网上书店系统的设计与实现 登录模块、购物车管理模块、购书模块、用户管理模块 使用java web 技术 ,本系统内为练习系统 对java web的初学者具有参考价值想学习 javaweb jsp +servlet 的可以 用来学习一下

资源截图

代码片段和文件信息

package com.haiersoft.db;

import com.haiersoft.entity.Book;

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

public class BookDao extends DBOper {
// 返回所有图书列表
public List getAllBook() {
List bookList = new ArrayList();
String sql = “SELECT * FROM books“;
try {
ResultSet rs = this.executeQuery(sql null);
while (rs.next()) {
Book book = new Book();
book.setIsbn(rs.getString(“isbn“));
book.setBookName(rs.getString(“bookName“));
book.setPublisherID(rs.getInt(“publisherID“));
book.setPrice(rs.getDouble(“price“));
book.setCount(rs.getInt(“count“));
book.setPic(rs.getString(“pic“));
book.setDescription(rs.getString(“description“));
bookList.add(book);
}
} catch (SQLException e) {
e.printStackTrace();
} finally {
this.closeAll();
}

return bookList;
}

// 根据ISBN查找一本图书
public Book getBookByIsbn(String isbn) {
Book book = null;
String sql = “SELECT * FROM books WHERE isbn=?“;
try {
ResultSet rs = this.executeQuery(sql new String[] { isbn });
if (rs.next()) {
book = new Book();
book.setIsbn(rs.getString(“isbn“));
book.setBookName(rs.getString(“bookName“));
book.setPublisherID(rs.getInt(“publisherID“));
book.setPrice(rs.getDouble(“price“));
book.setCount(rs.getInt(“count“));
book.setPic(rs.getString(“pic“));
book.setDescription(rs.getString(“description“));
}
} catch (SQLException e) {
e.printStackTrace();
} finally {
this.closeAll();
}
return book;
}

// 根据书名查找图书列表
public List getBookByName(String name) {
List bookList = new ArrayList();
String sql = “SELECT * FROM books WHERE bookName LIKE ‘%“ + name + “%‘“;
try {
ResultSet rs = this.executeQuery(sql null);
while (rs.next()) {
Book book = new Book();
book.setIsbn(rs.getString(“isbn“));
book.setBookName(rs.getString(“bookName“));
book.setPublisherID(rs.getInt(“publisherID“));
book.setPrice(rs.getDouble(“price“));
book.setCount(rs.getInt(“count“));
book.setPic(rs.getString(“pic“));
book.setDescription(rs.getString(“description“));
bookList.add(book);
}
} catch (SQLException e) {
e.printStackTrace();
} finally {
this.closeAll();
}

return bookList;
}

// 根据出版社ID查找图书列表
public List getBookByPublisher(int pid) {
List bookList = new ArrayList();
String sql = “SELECT * FROM books WHERE publisherID=“ + pid;
try {
ResultSet rs = this.executeQuery(sql null);
while (rs.next()) {
Book book = new Book();
book.setIsbn(rs.getString(“isbn“));
book.setBookName(rs.getString(“bookName“));
book.setPublisherID(rs.getInt(“publisherID“));
book.setPrice(rs.getDouble(“price“));
book.setCount(rs.getInt(“count“));
book.setPic(rs.getString(“pic“));
book.setDescription(rs.getString(“description“));
bookLi

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     文件        8429  2010-11-29 17:16  haier.sql
     目录           0  2012-06-26 20:52  ph08\
     文件         826  2010-10-21 16:38  ph08\.classpath
     文件        1037  2010-10-21 16:38  ph08\.project
     目录           0  2012-06-26 20:52  ph08\.settings\
     文件         454  2010-10-21 16:38  ph08\.settings\.jsdtscope
     文件         330  2010-10-21 16:38  ph08\.settings\org.eclipse.jdt.core.prefs
     文件         414  2010-10-21 16:38  ph08\.settings\org.eclipse.wst.common.component
     文件         308  2010-10-21 16:38  ph08\.settings\org.eclipse.wst.common.project.facet.core.xml
     文件          49  2010-10-21 16:38  ph08\.settings\org.eclipse.wst.jsdt.ui.superType.container
     文件           6  2010-10-21 16:38  ph08\.settings\org.eclipse.wst.jsdt.ui.superType.name
     目录           0  2012-06-26 20:52  ph08\build\
     目录           0  2012-06-26 20:52  ph08\build\classes\
     目录           0  2012-06-26 20:52  ph08\build\classes\com\
     目录           0  2012-06-26 20:52  ph08\build\classes\com\haiersoft\
     目录           0  2012-06-26 20:52  ph08\build\classes\com\haiersoft\db\
     文件        6224  2010-10-21 16:38  ph08\build\classes\com\haiersoft\db\BookDao.class
     文件        3798  2010-10-21 16:38  ph08\build\classes\com\haiersoft\db\DBOper.class
     文件        3797  2010-10-21 16:38  ph08\build\classes\com\haiersoft\db\UserDao.class
     目录           0  2012-06-26 20:52  ph08\build\classes\com\haiersoft\entity\
     文件        1712  2010-10-21 16:38  ph08\build\classes\com\haiersoft\entity\Book.class
     文件        1313  2010-10-21 16:38  ph08\build\classes\com\haiersoft\entity\User.class
     目录           0  2012-06-26 20:52  ph08\build\classes\com\haiersoft\filter\
     文件        2248  2010-10-21 16:38  ph08\build\classes\com\haiersoft\filter\CheckUserFilter.class
     文件        2063  2010-10-21 16:38  ph08\build\classes\com\haiersoft\filter\CompressFilter.class
     文件        1955  2010-10-21 16:38  ph08\build\classes\com\haiersoft\filter\CompressResponse.class
     文件         778  2010-10-21 16:38  ph08\build\classes\com\haiersoft\filter\GzipServletOutputStream.class
     目录           0  2012-06-26 20:52  ph08\build\classes\com\haiersoft\listener\
     文件        2480  2010-10-21 16:38  ph08\build\classes\com\haiersoft\listener\ListenLognum.class
     目录           0  2012-06-26 20:52  ph08\build\classes\com\haiersoft\servlet\
     目录           0  2012-06-26 20:52  ph08\build\classes\com\haiersoft\servlet\admin\
............此处省略209个文件信息

评论

共有 条评论