How thuxidau/cd_shopping_website works
Main Components
• Client/User Interface – represented by the web pages (JSPs, CSS, JS, images) inside the “web” directory.
• Presentation Layer – JSP pages and static resources (located in the “web” folder) that render the user interface.
• Controller Layer – Servlets found in “src/java/controller” handle user requests (e.g., LoginServlet, AddToCartServlet, etc.).
• Business Logic/Data Access Layer – The “src/java/dal” package contains the DAO classes that interact with the database. The “src/java/model” package holds business models (e.g., Product, Order, Users).
• Filter – A filter class (JSP_Filter in “src/java/filter”) processes incoming requests (likely managing sessions, authentication, etc.) before they hit the controllers.
• Database – The MySQL database is accessed via JDBC (using the connector provided as “lib/mysql-connector-j-8.4.0.jar”), with database scripts provided (script.sql).
Relationships and Interactions
• That the Servlets interact with the Business Logic/Data Access Layer (the DAO classes and model objects) to process the data.
• A Filter component that intercepts HTTP requests, positioned between the Client and Servlets.
• Optionally, display the build/configuration components (Ant build.xml and NetBeans project files) as supporting artifacts outside the main runtime flow.
Relevant Architectural Patterns and Technologies
• MVC Architecture – Though not strictly separated, the design follows a Model (dao, model), View (JSPs), and Controller (Servlets) pattern.
• Client-Server Model – Request handling from client browsers to the server-side application.
• Use of standardized Java web technologies – Java 17, JSP, Servlets, and JSTL.
• Utilization of session management, cookies, and filters for request processing.
• External libraries such as Bootstrap 3 for styling, JSTL for view logic, and MySQL Connector for the database connection.
• Controller to a “Business Logic Layer” that includes:
– Models (e.g., Product, Order, Users)
– DAOs (CategoryDAO, ProductDAO, OrderDAO, etc.)
• A side note for “Configuration & Build” that includes build.xml and project configurations, emphasizing that these support the actual deployment but are not part of the runtime flow.
• Optionally, mention that the system uses session management, and possibly denote that through an annotation near the filter or controller indicating session/cookie handling.