# tejask28/336project architecture

> Architecture diagram of the GitHub repository tejask28/336project, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tejask28/336project
- Repository: https://github.com/tejask28/336project

## Overview

##### Project Type and Purpose
- This is a Java EE dynamic web application (a monolithic full-stack web app) built with JSP, Servlets, and JDBC.
- It runs on Tomcat (Dynamic Web Module 6.1), uses Java 17, and connects to a MySQL database to support flight search, user/admin/customer-rep management, and portal pages.

##### Top-Level Components
a. Client Tier (Browser)
- JSP pages (src/main/webapp/*.jsp)
- Static assets (CSS under /css, JS under /js)
b. Web Server / Application Container
- Tomcat V11 hosting:
– Presentation Layer: JSP
– Controller Layer: Servlet classes (Login, Logout, SearchFlightsServlet, Admin, CustRep)
– Model / DAO Layer: Java beans (User, Admin, CustRep) and MySQL.java (JDBC connection & queries)
c. Database Tier
- MySQL Server accessed via mysql-connector-j JDBC driver

##### Relationships & Interactions
- Browser requests a JSP (e.g., SearchFlights.jsp).
- JSP sends form/action requests to a Servlet (annotated URL patterns).
- Servlet uses MySQL.java to open a JDBC connection and execute SQL on MySQL.
- Servlet processes ResultSet, populates Java beans (User, Flight data if implemented), stores data in request/session.
- Servlet forwards back to a JSP (e.g., results.jsp) which renders the view.

##### Architectural Patterns & Design Principles
- MVC pattern:
- Model: Java beans + JDBC layer
- View: JSP + static CSS/JS
- Controller: Servlets
- Monolithic deployment inside a single WAR on Tomcat.
- Layered separation (Presentation, Business, Data Access).

##### Technologies & Frameworks
- Java 17, Jakarta Servlet API 5.0
- JSP 3.x
- JDBC (mysql-connector-j 9.x)
- Apache Tomcat 11
- MySQL relational database

##### Final Touches
- Be exhaustive: include all servlets and JSPs that form entry points.
- Layers distinctly—don’t lump JSP and Servlets together.

## Diagram (Mermaid)

```mermaid
flowchart TB
    Browser["Client Browser"]:::external

    subgraph "Apache Tomcat (Dynamic Web Module)"
        subgraph "Presentation Layer (JSP & Static)"
            Home["Home.jsp"]:::presentation
            Welcome["Welcome.jsp"]:::presentation
            AdminLogin["AdminLogin.jsp"]:::presentation
            CustomerLogin["CustomerLogin.jsp"]:::presentation
            CustomerRepLogin["CustomerRepLogin.jsp"]:::presentation
            AdminPortal["AdminPortal.jsp"]:::presentation
            CustRepPortal["CustRepPortal.jsp"]:::presentation
            SearchPage["search.jsp"]:::presentation
            Results["results.jsp"]:::presentation
            ViewAircrafts["viewAircrafts.jsp"]:::presentation
            Airport["Airport.jsp"]:::presentation
            EditAirport["EditAirport.jsp"]:::presentation
            EditFlight["EditFlight.jsp"]:::presentation
            EditCustomer["EditCustomer.jsp"]:::presentation
            EditEmployee["EditEmployee.jsp"]:::presentation
            CreateCustomer["CreateCustomer.jsp"]:::presentation
            Header["header.jsp"]:::presentation
            CSS["styles.css"]:::static
            JS["adminPortal.js"]:::static
        end

        subgraph "Controller Layer (Servlets)"
            Login["Login.java"]:::controller
            Logout["Logout.java"]:::controller
            SearchServlet["SearchFlightsServlet.java"]:::controller
        end

        subgraph "Model Layer (JavaBeans)"
            UserBean["User.java"]:::model
            AdminBean["Admin.java"]:::model
            CustRepBean["CustRep.java"]:::model
        end

        subgraph "Data Access Layer (JDBC)"
            MySQLUtil["MySQL.java"]:::data
        end

        subgraph "WEB-INF & Libraries"
            WebXML["web.xml"]:::meta
            ServletAPI["jakarta.servlet-api-5.0.0-javadoc.jar"]:::meta
            MySQLConnector["mysql-connector-j-9.3.0.jar"]:::meta
            Manifest["MANIFEST.MF"]:::meta
        end
    end

    MySQLDB[(MySQL Database)]:::db

    Browser -->|HTTP GET| Home
    Home -->|includes| Header
    Home -->|link to| AdminLogin
    Home -->|link to| CustomerLogin
    Home -->|link to| CustomerRepLogin
    Home -->|load| CSS
    Home -->|load| JS

    AdminLogin -->|HTTP POST| Login
    CustomerLogin -->|HTTP POST| Login
    CustomerRepLogin -->|HTTP POST| Login

    Login -->|authenticate via DAO| MySQLUtil
    Login -->|forward| AdminPortal
    Login -->|forward| CustRepPortal
    Login -->|forward| SearchPage

    SearchPage -->|HTTP POST| SearchServlet
    SearchServlet -->|uses| MySQLUtil
    MySQLUtil -->|JDBC query| MySQLDB
    MySQLDB -->|ResultSet| MySQLUtil
    MySQLUtil -->|data| SearchServlet
    SearchServlet -->|forward| Results
    Results -->|render| Browser

    classDef presentation fill:#ADD8E6,stroke:#000;
    classDef controller fill:#98FB98,stroke:#000;
    classDef data fill:#FFA500,stroke:#000;
    classDef model fill:#FFE4B5,stroke:#000;
    classDef static fill:#E6E6FA,stroke:#000;
    classDef meta fill:#F0F0F0,stroke:#000;
    classDef external fill:#D3D3D3,stroke:#000;
    classDef db fill:#C0C0C0,stroke:#000;

    click Home "https://github.com/tejask28/336project/blob/main/src/main/webapp/Home.jsp"
    click Welcome "https://github.com/tejask28/336project/blob/main/src/main/webapp/Welcome.jsp"
    click AdminLogin "https://github.com/tejask28/336project/blob/main/src/main/webapp/AdminLogin.jsp"
    click CustomerLogin "https://github.com/tejask28/336project/blob/main/src/main/webapp/CustomerLogin.jsp"
    click CustomerRepLogin "https://github.com/tejask28/336project/blob/main/src/main/webapp/CustomerRepLogin.jsp"
    click AdminPortal "https://github.com/tejask28/336project/blob/main/src/main/webapp/AdminPortal.jsp"
    click CustRepPortal "https://github.com/tejask28/336project/blob/main/src/main/webapp/CustRepPortal.jsp"
    click SearchPage "https://github.com/tejask28/336project/blob/main/src/main/webapp/search.jsp"
    click Results "https://github.com/tejask28/336project/blob/main/src/main/webapp/results.jsp"
    click ViewAircrafts "https://github.com/tejask28/336project/blob/main/src/main/webapp/viewAircrafts.jsp"
    click Airport "https://github.com/tejask28/336project/blob/main/src/main/webapp/Airport.jsp"
    click EditAirport "https://github.com/tejask28/336project/blob/main/src/main/webapp/EditAirport.jsp"
    click EditFlight "https://github.com/tejask28/336project/blob/main/src/main/webapp/EditFlight.jsp"
    click EditCustomer "https://github.com/tejask28/336project/blob/main/src/main/webapp/EditCustomer.jsp"
    click EditEmployee "https://github.com/tejask28/336project/blob/main/src/main/webapp/EditEmployee.jsp"
    click CreateCustomer "https://github.com/tejask28/336project/blob/main/src/main/webapp/CreateCustomer.jsp"
    click Header "https://github.com/tejask28/336project/blob/main/src/main/webapp/header.jsp"
    click CSS "https://github.com/tejask28/336project/blob/main/src/main/webapp/css/styles.css"
    click JS "https://github.com/tejask28/336project/blob/main/src/main/webapp/js/adminPortal.js"
    click Login "https://github.com/tejask28/336project/blob/main/src/main/java/Login.java"
    click Logout "https://github.com/tejask28/336project/blob/main/src/main/java/Logout.java"
    click SearchServlet "https://github.com/tejask28/336project/blob/main/src/main/java/SearchFlightsServlet.java"
    click UserBean "https://github.com/tejask28/336project/blob/main/src/main/java/User.java"
    click AdminBean "https://github.com/tejask28/336project/blob/main/src/main/java/Admin.java"
    click CustRepBean "https://github.com/tejask28/336project/blob/main/src/main/java/CustRep.java"
    click MySQLUtil "https://github.com/tejask28/336project/blob/main/src/main/java/MySQL.java"
    click WebXML "https://github.com/tejask28/336project/blob/main/src/main/webapp/WEB-INF/web.xml"
    click ServletAPI "https://github.com/tejask28/336project/blob/main/src/main/webapp/WEB-INF/lib/jakarta.servlet-api-5.0.0-javadoc.jar"
    click MySQLConnector "https://github.com/tejask28/336project/blob/main/src/main/webapp/WEB-INF/lib/mysql-connector-j-9.3.0.jar"
    click Manifest "https://github.com/tejask28/336project/blob/main/src/main/webapp/META-INF/MANIFEST.MF"
```
