How swam-6/collegeevent works
This is a classic server-rendered Java web app packaged as a WAR and deployed to Apache Tomcat. It implements CRUD for “college events” using:
• JSP/JSTL for server-side views
• Servlet as the HTTP controller/router
• DAO pattern for persistence
• MySQL via JDBC for storage
Controller (HTTP entrypoint)
• src/main/java/com/college/events/EventServlet.java
• WEB-INF/web.xml (deployment descriptor) defines servlet mapping (even if annotations are used, web.xml is present, so include it as config)
Domain Model
• Event.java — POJO representing an event; include as “Domain Model / DTO” in the backend layer
Persistence layer (Data Access)
• EventDAO.java — CRUD logic (SQL operations)
• DBConnection.java — connection factory/utility (JDBC URL/user/password live here)
Database
• database.sql — schema/bootstrap script
• MySQL connector present in target/.../mysql-connector-j-8.0.33.jar
Build/Packaging/Deployment
• pom.xml — Maven build producing target/CollegeEvents.war
• target/CollegeEvents/... — exploded WAR (output artifact), shows runtime libs and web resources
User Browser sends HTTP request
• GET /CollegeEvents/events
• GET /events?action=new
• GET /events?action=edit&id=...
• GET /events?action=delete&id=...
• POST /events (create/update)
EventServlet
• Parses query params (action, id) and/or POST body
• Invokes EventDAO methods (e.g., list, insert, update, delete, findById)
EventDAO
• Uses DBConnection to obtain a JDBC Connection
• Executes SQL against MySQL
Results return upward
• DAO returns Event / List<Event> to Servlet
• Servlet sets request attributes and forwards to JSP (index.jsp / event-form.jsp)
JSP renders HTML (with JSTL) → Tomcat returns HTML response to Browser.
• HTTP request: action, id, form fields
• Domain objects: Event, List<Event>
• SQL: SELECT/INSERT/UPDATE/DELETE
• Response: HTML
Architectural patterns/principles to highlight (make it explicit)
• MVC-ish separation
• View: JSP/JSTL
• Controller: Servlet
• Model: POJO (Event)
• DAO pattern
• EventDAO isolates SQL/JDBC from servlet logic
• Layering
• Presentation → Controller → Persistence → Database
• Packaging
• WAR deployed to Tomcat; dependencies bundled via Maven
“Don’t overthink it” detail checklist (separate into as many components as possible)
To maximize detail for this small project, include these extra callouts:
• Action routing logic in Servlet (action=new/edit/delete) as a note near EventServlet
• Connection details: JDBC URL points to jdbc:mysql://localhost:3306/college_events
• Libraries at runtime (from target/.../WEB-INF/lib/): JSTL, MySQL connector (as “runtime dependencies” annotation)
• Deployment: “WAR → Tomcat webapps/ → context path /CollegeEvents”