How rameshmf/todo-application-jsp-servlet-jdbc-mysql works
Project type and purpose
• This is a monolithic Java‑based web application (“Todo Application”) built on JSP, Servlet, JDBC and MySQL.
• It follows a simple MVC pattern: JSPs for views, Servlets as controllers, DAO layer for persistence, and MySQL as the data store.
• Core features: user signup/login and basic CRUD operations on todo items.
File structure
• WebContent/
– JSP pages organized by feature: login/, register/, todo/, plus common header/footer includes.
– WEB-INF/lib contains runtime dependencies (servlet API, jsp API, JSTL, MySQL connector).
– web.xml for Servlet mappings and application configuration.
• src/net/javaguides/todoapp/
– web/: Servlet controllers (LoginController, UserController, TodoController).
– dao/: DAO interfaces and implementations (LoginDao, UserDao, TodoDaoImpl).
– model/: POJOs representing User, LoginBean, Todo entities.
– utils/: JDBCUtils for obtaining DB connections.
• script.sql defines the MySQL schema and tables.
• build classes mirror the compiled code, confirming the package structure.
README for additional insights
• Confirms technology stack (Java 8+, Tomcat 8+, MySQL).
Main components
a. Client Tier
– Browser / HTTP client requesting JSP pages and submitting forms.
b. Web/Application Server
– Tomcat container hosting:
• JSP engine (renders JSPs into HTML)
• Servlet container (executes controllers: LoginController, UserController, TodoController)
– web.xml defines URL → Servlet mappings.
c. Presentation Layer
– JSP view files (login.jsp, register.jsp, todo-form.jsp, todo-list.jsp) plus header/footer includes.
d. Controller Layer
– Servlets that receive HTTP requests, invoke DAO methods, set request attributes, and forward to JSPs.
e. Persistence Layer
– DAO interfaces and implementations that encapsulate SQL operations (add, edit, list, delete).
– JDBCUtils managing Connection pooling and resource cleanup.
f. Database
– MySQL server hosting tables for users and todos (defined by script.sql).
g. External libraries
– JSTL for view logic, MySQL Connector/J for JDBC, Servlet/JSP APIs.
Relationships and data flows
• Inside Tomcat: request → Servlet (Controller) → calls DAO → JDBCUtils → MySQL DB → result set.
• Controller populates Model objects → forwards to JSP → JSP renders HTML → HTTP response back to Browser.
• Static includes (header/footer) drawn as sub‑components of the view layer.
Architectural patterns and design principles
• MVC: clear separation between Model (POJOs), View (JSPs), Controller (Servlets).
• Layered architecture: presentation, controller, persistence, database.
• Single codebase monolith—no microservices.