The chathtml.html file calls the ChatMainApplet.java file to send the login information specified by an end user to the Jabber server. Listing 5-4 shows the contents of the chathtml.html file:
Listing 5-4: The chathtml.html File
|  | 
 <HTML> <HEAD> <TITLE>Instant Technical Support Application</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='loginpage.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="ChatMainApplet" width="450" height="500">');    document.writeln(buildParamTag('username', appletparam('username')));    document.writeln(buildParamTag('password', appletparam('password')));    document.writeln(buildParamTag('firstname', appletparam('firstname')));    document.writeln(buildParamTag('lastname', appletparam('lastname')));    document.writeln(buildParamTag('emailid', appletparam('emailid')));    document.writeln('</APPLET>');   } function buildParamTag(name, value) {    return '<PARAM NAME="' + name + '" VALUE="' + value + '">'; } </SCRIPT> </HEAD> <BODY> <SCRIPT LANGUAGE="JavaScript"> writeAppletTag(); </SCRIPT> </BODY> </HTML>  |  | 
Download this listing.
In the above code, the writeAppletTag() function calls the ChatMainApplet.java file to create the user interface of the Instant Technical Support application.