Fall 2023 - CS506 - 2
Fall 2023 - CS506 - 2
Instructions:
Please read the following instructions carefully before submitting the assignment. It should be clear
that your assignment will not get any credit if:
Objectives:
The objective of this assignment is to provide hands-on experience of Java Programming concepts
including:
Servlet Basics
Process Request
Member Functions and main function
1. Transaction Servlet:
o Create a Servlet named TransactionServlet.
o Design an HTML form that allows the user to enter their initial account balance,
specify whether they want to make a deposit or withdrawal, and enter the transaction
amount.
o Perform the deposit or withdrawal operation based on the user's input.
o Store the updated account balance as an attribute in the request.
o Forward the request to BalanceServlet (using the Request Dispatcher method).
2. Balance Servlet:
o Create a Servlet named BalanceServlet.
o Retrieve the updated account balance from the request attribute set by
TransactionServlet.
o Calculate the new account balance after the transaction.
o Display the new balance on the web page, along with a message indicating whether
the transaction was successful.
Note: No need to send complete code, just send the code of processRequest() method of each Servlet.
Details are given below:
Solution:
FirstServlet (TransactionServlet) processRequest() method:
protected void process request(HttpServletRequest request, HttpServletResponse response) throws
ServletException, IOException{