Sending Personal Information to the Reservation.html File


The Reservation.html file accepts an end user's personal information and calls the ReservationStatus.java file to create the user interface for the Airline Reservation application. Listing 6-2 shows the contents of the Reservation.html file:

Listing 6-2: The Reservation.html File

start example
 <HTML> <HEAD> <TITLE> Airline Reservation </TITLE> <script> function PageQuery(q)  {    if(q.length > 1) this.q = q.substring(1, q.length);    else this.q = null;    this.keyValuePairs = new Array();    if(q)    {       for(var i=0; i < this.q.split("&").length; i++)        {          this.keyValuePairs[i] = this.q.split("&")[i];       }    }    this.getKeyValuePairs = function() { return this.keyValuePairs; }    this.getValue = function(s) {    for(var j=0; j < this.keyValuePairs.length; j++) {    if(this.keyValuePairs[j].split("=")[0] == s)    return this.keyValuePairs[j].split("=")[1];    }    return false; } this.getParameters = function() {    var a = new Array(this.getLength());    for(var j=0; j < this.keyValuePairs.length; j++) {    a[j] = this.keyValuePairs[j].split("=")[0];    }    return a; } this.getLength = function() { return this.keyValuePairs.length; }  } function queryString(key){    var page = new PageQuery(window.location.search);     return page.getValue(key);     }    function appletparam(key){    if(queryString(key)=='false')     {       pagename='UserInformation.html';       windowname='login';       window.open(pagename,windowname,'width=400,height=200,left=300,top=100,screenX=500,screenY=100');    }    else    {    return queryString(key);    } } </script> <SCRIPT LANGUAGE="JavaScript"> function writeAppletTag() {    document.writeln('<applet code="ReservationStatus" width="700" height="600">');    document.writeln(buildParamTag('city',appletparam('city')));    document.writeln(buildParamTag('firstname',appletparam('firstname')));                    document.writeln(buildParamTag('lastname',appletparam('lastname')));    document.writeln(buildParamTag('emailid',appletparam('emailid')));    document.writeln(buildParamTag('address',appletparam('address')));    document.writeln('</APPLET>');                 } function buildParamTag(name, value) {    return '<PARAM NAME="' + name + '" VALUE="' + value + '">'; } </SCRIPT> </HEAD> <BODY> <SCRIPT LANGUAGE="JavaScript"> writeAppletTag(); </SCRIPT> </applet> </BODY> </HTML> 
end example

Download this listing.

In the above code, the Reservation.html file calls the ReservationStatus.java file to create the user interface for the Airline Reservation application. The ReservationStatus.java file passes an end user's personal information to the ReservationStatus.java file.




Developing Applications Using Jabber
Developing Applications Using Jabber
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 68

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net