Home Assignment 2: Server-Side Processing & Spring Core
Overview
Build practical server-side and Spring Core skills by implementing session management with Servlets/JSP and dependency injection with Spring IoC.
Due Date: February 25, 2026, 11:59 PM
Points: 100
Target Audience: CO3 (Servlets/JSP) and CO4 (Spring Core)
Objective
Understand server-side request handling, session management, and dependency injection.
Learning Objectives
By completing this assignment, you will:
- Handle HTTP POST requests in a Servlet.
- Manage user state using HttpSession and session invalidation.
- Use JSP implicit objects for dynamic user-facing output.
- Implement Spring IoC using dependency injection and auto-wiring.
- Demonstrate singleton bean scope behavior in Spring.
Question 1: Session Management System (CO3)
Develop a web application using Servlets and JSP to simulate a simple login system.
Requirements
- Servlet: Create a
LoginServletthat handles an HTTP POST request. - Logic: Hardcode a username/password check in the Servlet.
- Session tracking: If login is successful, create an
HttpSessionto store the username. - JSP: Redirect user to
welcome.jsppage that uses implicit objects to display: Welcome, [Username]. - Include a Logout link that invalidates the session.
Deliverable
Java Servlet code and JSP file.
Question 2: Dependency Injection with Spring (CO4)
Demonstrate Spring Inversion of Control (IoC) by creating a simple Java application.
Requirements
- Scenario: Create interface
MessageServicewith two implementations:EmailServiceandSMSService. - Configuration: Use annotation-based configuration (or XML if preferred) to inject one service into
NotificationControllerusing auto-wiring. - Bean scope: Define
NotificationControllerbean with singleton scope and print console message to prove only one instance is created.
Deliverable
Java classes and configuration file/class.
NoteAssignment Guidelines
- Complete Question 1 and Question 2 as separate modules or packages.
- Test login/session behavior with both valid and invalid credentials.
- Verify Spring dependency injection and bean scope behavior using logs.
- Keep code and configuration files clearly organized.
Deliverables
- Question 1 source files (Servlet + JSP + related web config if used).
- Question 2 source files (interface, implementations, controller, config class/XML).
- README.txt containing:
- Your name and roll number
- Build/run steps for both questions
- Assumptions and test credentials for login
TipSubmission Format
- Verify login flow works for valid and invalid credentials.
- Confirm session value appears on welcome page and logout invalidates session.
- Run Spring app and demonstrate singleton behavior with console output.
- Include all source and configuration files.
- Add clear run instructions in README.
- Zip and submit using naming format below.
- Submit ZIP as
RollNumber_Assignment2_YourName.zipbefore deadline.
ImportantEvaluation Criteria
| Criteria | Points | Description |
|---|---|---|
| Question 1: Servlet + Session + JSP | 50 | Correct POST handling, login logic, session usage, welcome/logout flow |
| Question 2: Spring IoC + DI + Scope | 40 | Interface design, auto-wiring/configuration, singleton demonstration |
| Code Quality and Documentation | 10 | Structure, naming, comments, and README clarity |
| Total | 100 |