Week 7: Feb 23 - Mar 1, 2026
Unit III Transition: Request Handling to Session Tracking
Week Overview
This week continues Unit III by covering practical request handling in servlets and introducing state management with cookies.
Course Outcome: CO-3 (K3 - Application)
Duration: 1 week (3 lectures + 1 lab)
Lab: Browser Information, Objects, and Script Reuse
Home Assignment 2 Due: Feb 25
Lecture 19: Handling HTTP GET & POST Requests
Key Concepts
- Purpose of
doGet()anddoPost()in servlet development - Reading parameters using
request.getParameter() - Designing safe request processing flows
Typical Example
Lecture 20: Redirecting Requests & Request Dispatching
Key Concepts
- Difference between server-side forward and client-side redirect
- Correct use of
RequestDispatcherandsendRedirect() - Request attribute handling during navigation
Decision Rule
- Use
forward()when request attributes are needed on the next page - Use
sendRedirect()after successful form submissions
Lecture 21: Session Tracking using Cookies
Key Concepts
- Why session tracking is required in HTTP applications
- Creating and reading cookies in servlet-based apps
- Security and expiry considerations
Example
Lab 5: Browser Information, Objects, and Script Reuse
Objectives
- Inspect browser/client details from request objects
- Practice reusable JavaScript modules and utility methods
- Integrate dynamic client behaviour with server-side flow
Activities
- Build a page that shows browser details and request headers.
- Store a temporary user value using cookies.
- Add reusable JavaScript functions for validation/formatting.
- Test both success and failure flows.
Key Takeaways
✅ doGet() and doPost() solve different request needs
✅ Forward and redirect are both essential but used in different scenarios
✅ Cookies provide lightweight session tracking support
Next Week
Continue Unit III with: - Lecture 22: Session Tracking with HttpSession - Lecture 23: JSP Introduction and implicit objects - Lecture 24: JSP directives, actions, and custom tags