How lokesh-141/servlet works
1. This repository is not one single app; it contains three separate Java EE web applications: TechBlog, Register, and feedback_app. Each is deployed as a servlet/JSP application with its own entry points, views, and packaging boundary.
2. The largest system is TechBlog, a classic MVC blog platform. Its runtime boundary is a Java web container such as Tomcat/Glassfish, with HTTP requests entering servlets, business/data access happening in Java classes, and HTML generated by JSP pages.
3. In TechBlog, the controller layer lives under com.tech.blog.servlets. These servlets handle actions such as login, logout, registration, creating posts, editing posts, and liking posts. They are the main request-routing layer and decide which JSP to render next.
4. The model and persistence boundary is split across com.tech.blog.entities and com.tech.blog.dao. Entity classes like User, Post, Category, and Message represent domain data, while DAO classes encapsulate JDBC-based database operations for users, posts, and likes.
5. TechBlog connects to the database through com.tech.blog.helper.ConnectionProvider, with Helper providing supporting utilities. The README indicates MySQL is the backing store, so the key external dependency is JDBC access from the DAOs to a relational database.
6. The view layer for TechBlog sits under Web Pages. JSP files such as index.jsp, login_page.jsp, register_page.jsp, profile.jsp, show_blog_page.jsp, and load_posts.jsp render the UI. Static assets are separated into css, js, img, and pics, with normal_navbar.jsp acting as a reusable UI fragment.
7. Typical TechBlog data flow is: browser submits a form or action to a servlet, the servlet validates or transforms request data, calls the relevant DAO, the DAO reads/writes MySQL, and the servlet forwards to a JSP with request/session attributes for rendering. This is the central diagram path for the blog application.
8. The TechBlog application also has a standard WEB-INF/web.xml, which defines servlet deployment configuration and URL mapping for the container. This reinforces that the app is organized around servlet endpoints rather than a framework like Spring.
9. The Register project is a much smaller standalone servlet/JSP demo. Its structure suggests a simple registration flow with Register.java as the server-side handler and signup.jsp as the form/view, likely intended to demonstrate basic request handling rather than a full domain model.
10. The feedback_app is another separate mini-application focused on form submission and request processing. It includes FirstServlet.java, Request1Servlet.java, and Request2Servlet.java, plus JSPs like feedback.jsp, index.jsp, header.jsp, and links.jsp; this looks like a teaching/demo app for servlet forwarding, request chaining, and page composition.
11. feedback_app also has its own pom.xml and web.xml, indicating it is independently buildable and deployable from TechBlog. Unlike TechBlog, there is no DAO/entity/database layer visible, so its main boundary is browser-to-servlet-to-JSP rather than browser-to-servlet-to-database.
12. From an architecture diagram perspective, the main reusable pattern across the repo is: client browser → servlet controller → optional DAO/database → JSP view response. The important distinction is that TechBlog uses the full MVC stack with persistence, while Register and feedback_app are lighter-weight servlet/JSP examples with simpler flows.
Main entry points: com.tech.blog.servlets Servlets · Request1Servlet.java Request1 · web.xml web.xml · com.tech.blog.dao DAOs
Components 16
TechBlog
Full MVC blog app with servlet controllers, JDBC persistence, and JSP views.
- Web Container · Servlet/JSP runtime boundary for the blog app.
- Servlets · Main request-routing layer for login, posts, likes, and registration.
TechBlog/Source Packages/com.tech.blog.servlets - DAOs · JDBC-based data access for users, posts, and likes.
TechBlog/Source Packages/com.tech.blog.dao - Entities · Domain objects for users, posts, categories, and messages.
TechBlog/Source Packages/com.tech.blog.entities - Helpers · Database connection and supporting utility classes.
TechBlog/Source Packages/com.tech.blog.helper - JSP Views · User-facing pages and reusable JSP fragments.
TechBlog/Web Pages - Static Assets · Styles, scripts, images, and other browser resources.
TechBlog/Web Pages/css - MySQL · Relational backing store used by the blog DAOs.
- web.xml · Servlet deployment and URL mapping configuration.
TechBlog/Web Pages/WEB-INF/web.xml
Register
Small standalone servlet/JSP registration demo.
- Register.java · Single-handler registration demo endpoint.
Register/Register.java - signup.jsp · Registration form and response page.
Register/signup.jsp
feedback_app
Mini servlet/JSP app for request handling and page composition.
- FirstServlet · Primary entry servlet for the feedback demo.
feedback_app/FirstServlet.java - Request1 · Intermediate servlet used for forwarding or chaining.
feedback_app/Request1Servlet.java - Request2 · Downstream servlet in the request-processing chain.
feedback_app/Request2Servlet.java - JSP Pages · Feedback forms and composed JSP fragments.
feedback_app/feedback.jsp - web.xml · Servlet mappings for the feedback app.
feedback_app/web.xml
Connections 18
- Web Container → web.xml: maps · Container reads deployment mappings.
- Web Container → Servlets: dispatches · HTTP requests enter servlet endpoints.
- Servlets → DAOs: calls · Controllers invoke data access for persistence.
- Servlets → Entities: uses · Request data is bound to domain objects.
- DAOs → Helpers: uses · DAOs obtain JDBC connections through helpers.
- Helpers → MySQL: connects · Connection provider reaches the MySQL backend.
- DAOs → MySQL: reads/writes · DAO layer persists blog data in the database.
- Servlets → JSP Views: forwards to · Controllers render the appropriate JSP page.
- JSP Views → Static Assets: includes · Pages reference shared CSS, JS, and images.
- Register.java → signup.jsp: renders · Servlet handles submit and forwards to the JSP.
- FirstServlet → Request1: forwards · Primary servlet passes control to the next step.
- Request1 → Request2: chains to · Request flow continues through a servlet chain.
- FirstServlet → JSP Pages: renders · Servlets compose or return JSP-based feedback pages.
- Request1 → JSP Pages: renders · Intermediate servlet may forward to shared JSPs.
- Request2 → JSP Pages: renders · Downstream servlet completes the response with JSPs.
- web.xml → FirstServlet: maps · Deployment descriptor registers servlet endpoints.
- web.xml → Request1: maps · Deployment descriptor registers servlet endpoints.
- web.xml → Request2: maps · Deployment descriptor registers servlet endpoints.