0% found this document useful (0 votes)
12 views2 pages

Java Lab5 Servlet Prog

This document outlines the assignments for the Advanced Java Lab focusing on Servlet Programming for BSc-IV semester students at Mithibai College. The assignments include tasks such as demonstrating the Servlet Life Cycle, creating an e-commerce discount calculator, using Request Dispatcher, and implementing session management schemes. Students are required to submit their work by January 9, 2026, after starting on January 3, 2026.

Uploaded by

sohamkadu88
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views2 pages

Java Lab5 Servlet Prog

This document outlines the assignments for the Advanced Java Lab focusing on Servlet Programming for BSc-IV semester students at Mithibai College. The assignments include tasks such as demonstrating the Servlet Life Cycle, creating an e-commerce discount calculator, using Request Dispatcher, and implementing session management schemes. Students are required to submit their work by January 9, 2026, after starting on January 3, 2026.

Uploaded by

sohamkadu88
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd

SVKM's

MITHIBAI COLLEGE (AUTONOMOUS) Mumbai


Department of Computer Science

Advanced J a v a L a b -
Assignments for BSc-IV semester
SERVLET PROGRAMMING
Lab Assignment No:-5

Assignment Date:-03/01/2026
Submission Date: - 09/01/2026

Aim: - Servlet Programming


Write up:-
 Servlet Vs CGI
 Web container
 Servlet API diagram
 Request Dispatcher
 Session Management schemes
 Servlet config vs servlet context

1] Write a Java Servlet program to demonstrate the Servlet Life Cycle by


implementing a request counter with the following tasks:

 In init()
→ Initialize a counter variable to zero and print the message
“Servlet Initialized” in the server console.
 In service()
→ Increment the counter for every client request and display
“Servlet is Processing Request” along with the current request count on
the browser.
 In destroy()
→ Print the message “Servlet Destroyed” and the total number of
requests handled in the server console

2] Write a Java Servlet program for an e-commerce platform to calculate the final
payable amount after applying discounts.

Accept product price and membership type (Regular/Premium).

Apply discount rules: Regular → 10% , Premium → 20%

Display discount amount and final price.

Use servlet request handling.

3] Create a servlet to a use Request dispatcher and use the forward method to
forward the request to another servlet which gives back the result to browser.
Servelt 1: is login page with user name and password
Servlet 2 display user name and send the result to browser.

4] Create a Servlet to show a current date for initial visit and current date and last
access date from second visit onwards. (Use concept of HTTP session to write the
program).

5] Create a Servlet that will show a heading “Welcome Newcomer” for initial visit and
“Welcome Back” from second visit onwards. (Use concept all session management
schemes except cookies.

6] Create a servlet to display user name and no. of times user visited using cookies

7] Create a program to implement servlet Config and servlet context.

**********Kindly adhere to the submission date************

You might also like