Lecture 17: Servlet Overview & Architecture

BMC201 - Web Technology

Mr. Prashant Kumar Nag

2026-02-23

Lecture 17

Servlet Overview & Architecture

Week 5 | Unit III: Web App Development (Servlets + JSP)
BMC201 - Web Technology
Mr. Prashant Kumar Nag, Assistant Professor

Learning Objectives


  • Explain Servlet role in Java web architecture
  • Identify container responsibilities and request flow
  • Build and map a first servlet

Prerequisites


  • Java basics: classes, methods, objects, and exception handling
  • HTTP request-response fundamentals from Unit I/II web context
  • Revision of Lecture 16 before moving into Servlet Overview & Architecture

Syllabus Mapping


  • Unit III topic focus: Servlet Overview & Architecture
  • CO alignment: implementation understanding + architecture reasoning
  • Assessment alignment: short definitions + long implementation/design questions

Agenda


  • 5-minute recap from previous lecture
  • Concept deep dive: Servlet Overview & Architecture
  • Code/configuration walkthrough and output analysis
  • Debug checklist and exam-oriented summary

Introduction


Servlets are server-side Java components that generate dynamic responses.

Think About It


Where does dynamic response logic execute for each request?

Servlet Architecture


Browser -> Web Server -> Servlet Container -> Servlet -> Response

Code Walkthrough


@WebServlet("/hello")
public class HelloServlet extends HttpServlet {
  protected void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException {
    res.setContentType("text/plain");
    res.getWriter().println("Hello from Servlet");
  }
}

Memory Booster


Syllabus memory points for Servlet Overview & Architecture:

  • Core recall: Servlet container request-response pipeline
  • Exam compare: Servlet vs static resource delivery
  • Practical anchor: Trace full request flow from browser to servlet response

Live Demo


Live implementation for Servlet Overview & Architecture:

?? Open Demo: Lecture 17 - Servlet Overview & Architecture

Demo checklist: - implement the key flow for this lecture - verify expected output for one success case - trigger one failure case and explain the fix

Resources & References


Structured Debug Checklist


  1. verify the primary API usage for Servlet Overview & Architecture is correct (imports, method names, config)
  2. check request/bean/session flow and object lifecycle assumptions
  3. inspect server logs for the first exception (not just the final symptom)
  4. reproduce one failing case and one passing case before finalizing fixes

Exam Preparation Questions: Short


  • Define Servlet Overview & Architecture with one practical use case.
  • Write/identify the key API or construct: Servlet container request-response pipeline.
  • Differentiate: Servlet vs static resource delivery.
  • Mention one common implementation error and correction.

Exam Preparation Questions: Long


  • Explain Servlet Overview & Architecture with architecture/flow and implementation steps.
  • Write a structured answer comparing two approaches used in this topic.
  • Discuss debugging strategy for this topic with likely failure points.

Practice Task


  • Implement: Trace full request flow from browser to servlet response.
  • Add console/log output to validate flow step-by-step.
  • Document one bug you encountered and the exact fix.

Checklist


Can you:

  • explain Servlet Overview & Architecture in your own words?
  • implement a basic example end-to-end?
  • identify and fix one common runtime issue?

Next Lecture


  • Topic: Lecture 18 - Servlet Interface & Life Cycle
  • Preparation required: revise this lecture summary and code walkthrough

Questions?

Next: Lecture 18