Assignment # 3

                                                                                   Wei's Bank

Description of the Problem:

                  To write a  HTML file using various form elements and then to write a Servlet.The servlet should get the
parameters from the fields on the form and return an html page of output that presents or responds to the user data.
                 Here the HTML file is a Bank System which gets the custom information from the user .The user is allowed
to enter user's Name, Account Number and to select which function and enter how many money he would like to do.  Those information will  then be passed to the servlet which performs the operation (Saving or Withdraw) and  returns the final information to the user. The result is returned in the form of another HTML page.
 
 

Description of the Algorithm:

         The HTML file contains TextBox to get the user name, user card number. Then there have one comboBox to select which way to be operation: doposit or withdraw. Then to select which account to be saving or withdraw(checking or saving). If done then put the number to show how much you would want to do. and click "Submit" to save your information and show another HTML page which include those information by Servlet, or click "Reset" to reset your information.
  The HTML form submits the page using POST method. The main java file is called ServletBank.java.This file extends HTTPServlet.The doPost method takes as its parameters HTTPServletRequest and HTTPServletResponse.All the values entered in the HTML form are collected using
HTTPServletRequest using the method getParameter. Then a HTML page is formed on the run in the Calculator.java Servlet.The HTML page is created using the HTTPServletResponse method.PrintWriter is used to create a new OutputStream by getting the HTTPServletResponse method getOutputStream.Then normal HTML tags like <HTML>,<BODY>,<TITLE> etc are written into the OutputStream.
 

  •   ServletBank.java
  • ENTER :
  •  Enjoy



  • Back to Homepage