Coder Social home page Coder Social logo

ivan-fang / online-bookstore Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 9.4 MB

一個使用 JDBC、Servlet、Filter、Listener 與 reflection 完成的簡易版線上書城系統。A simple version of the online bookstore system that use JDBC, Servlet, Filter, Listener, and reflection to complete.

Java 11.33% CSS 5.88% JavaScript 73.10% HTML 9.69%
java javaweb mysql thymeleaf

online-bookstore's Introduction

線上書城

專案介紹

  • 本專案是一個簡易版的線上書城系統,包含以下功能:

    • 會員註冊、會員登入、會員登出

    • 展示商品(書籍)資訊

    • 添加商品至購物車、查看購物車內容、

    • 結帳、查詢購物紀錄

  • 本專案採伺服器端渲染(server-side rendering)模式開發。伺服器處理完請求後會先用 Thymeleaf 進行頁面渲染,然後才把渲染好的頁面回傳給客戶端。

  • 本專案未使用 SpringBoot、SSM 等框架,而使用使用 Java Web 基本組件(ServletFilterListener) 與 JDBC 進行開發。

  • 此外,本專案利用 Java 中的 reflection 技術模擬了 Spring 中的依賴注入(dependency insertion)功能,以及 SpringMVC 中的 DispatcherServlet 功能。

  • 本專案為 尚硅谷《Java Web》 的 Course Project。

成果展示

  • 會員登入與註冊頁面

  • 商品展示頁面


  • 購物車頁面


  • 購物紀錄查詢頁面


細節說明

本專案使用以下技術完成各項功能的開發:

  • 使用 Filter 進行登入驗證以及設定字元編碼。

  • 使用 JDBC 進行增刪改查操作以及事務管理。

  • 透過自定義方法讀取 bean 配置文件,並用 reflection 創建實例儲存到自定義 IoC 容器中,以及進行賴注入。

    • 本專案的 bean 配置文件格式與 Spring 一致,主要用於存取 controller、service 與 dao 物件,及其依賴關係。

    • 程式碼詳見:/src/ioc/ClassPathXmlApplicationContext.java

  • 使用 Servlet 接收請求,根據網址從自定義 IoC 容器中取出 controller,並透過 reflection 調用該 controller 的方法。

    • 程式碼詳見:/src/servlet/DispatcherServlet.java
  • 使用 Listener 讓專案在 ServletContext 初始化時就根據 bean 配置建創建 IoC 容器。

  • 使用 Thymeleaf 進行頁面渲染。

開發環境

  • 程式語言:Java 1.8

  • 數據源:MySQL 8.0.33、Druid 1.1.10

  • Web 容器:Tomcat 8.5.91

  • 模板引擎:Thymeleaf 3.0.12

online-bookstore's People

Contributors

ivan-fang avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.