Objective:


Writing the HTML form and a servlet at the server site. An HTML form consists of various form elements (or controls) such as text fields, checkboxes, radio buttons, and so forth.
 

Description:

Flight Reservation System:
The system is designed in a way that user can enter input with a wide variety of form elements, and submit the input form through a web browser.  This form elements are processed by an servlet on the server site.

The servlet is responsible for data-format check, adding reservations into a file database, searching and deleting current entries. The file database consists of user-entered input values surrounded by proper tag entries outside, like <name>aname</name>. Each record is also surrounded by the following tags, <reservation> and </reservatiopn>. This way provides us easy-to-manipulate  file format. Records and their individual entries can be entered in any format. The servlet
always return html output back to the browser, and these outputs may contain other HTML forms to provide an interactive environment to the user. The on the fly produced HTML forms are again handled by the same servlet with respect to their
parameters.
 

User should enter his personal data to make a reservation. However, just entering his last name is enough to see
his itineraries. Any itinerary can be cancelled by pressing "cancel" button on the right.

The important methods  and  the classes used in the program are:

service(HttpServletRequest , HttpServletResponse) : handle requests of browser
public String getVal(String rsv,String tag) : extract value of a tag in the reservation
public  void makeReservation(String rsv,HttpServletRequest request,PrintWriter out) makes a reservation, it appends the reservation record at the end of the file database.
public  void cancelReservation(String rsv,HttpServletRequest request,PrintWriter out) delete the reservation record from the file.
public void showReservation(String rsv,HttpServletRequest request,PrintWriter out) shows one's itineraries.
void printReservation(String rsv,PrintWriter out)  writes the reservation in  HTML format to the output.   void printPersonalInfo(String rsv,PrintWriter out)  writes the personal information in  HTML format to the output.
boolean compare(String r1, String r2) compare two itineraries for cancellation purposes.