Home Assignment 2: Server-Side Processing & Spring Core

Published

February 9, 2026

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 LoginServlet that handles an HTTP POST request.
  • Logic: Hardcode a username/password check in the Servlet.
  • Session tracking: If login is successful, create an HttpSession to store the username.
  • JSP: Redirect user to welcome.jsp page 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 MessageService with two implementations: EmailService and SMSService.
  • Configuration: Use annotation-based configuration (or XML if preferred) to inject one service into NotificationController using auto-wiring.
  • Bean scope: Define NotificationController bean 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
  1. Verify login flow works for valid and invalid credentials.
  2. Confirm session value appears on welcome page and logout invalidates session.
  3. Run Spring app and demonstrate singleton behavior with console output.
  4. Include all source and configuration files.
  5. Add clear run instructions in README.
  6. Zip and submit using naming format below.
  7. Submit ZIP as RollNumber_Assignment2_YourName.zip before 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

Resources