import java.util.*; import java.io.*; class Html { /** * Html.java
* *
*
* Revised based on Pat Durante's cgi_lib.java
*
* //@version 1.0
* //@author Pat L. Durante
*
* @version 1.0 aug-13-2002
* @author Xiannong Meng
*/
public static Hashtable
*
* Data passed through the CGI API is URL encoded by the browser.
* All spaces are turned into plus characters (+) and all "special"
* characters are hex escaped into a %dd format (where dd is the hex
* ASCII value that represents the original character). You probably
* won't ever need to call this routine directly; it is used by the
* ReadParse method to decode the form data.
*
* @param in The string you wish to decode.
*
* @return The decoded string.
*
*/
public static String urlDecode(String in)
{
StringBuffer out = new StringBuffer(in.length());
int i = 0;
int j = 0;
while (i < in.length())
{
char ch = in.charAt(i);
i++;
if (ch == '+') ch = ' ';
else if (ch == '%')
{
ch = (char)Integer.parseInt(in.substring(i,i+2), 16);
i+=2;
}
out.append(ch);
j++;
}
return new String(out);
}
/**
*
* Generate a standard HTTP HTML header.
*
* @return A String containing the standard HTTP HTML header.
*
*/
public static String Header()
{
return "Content-type: text/html\n\n";
}
/**
*
* Generate some vanilla HTML that you usually
* want to include at the top of any HTML page you generate.
*
* @param Title The title you want to put on the page.
*
* @return A String containing the top portion of an HTML file.
*
*/
public static String HtmlTop(String Title)
{
String Top = new String();
Top = "\n";
Top+= "\n";
for (Enumeration
\n";
return returnString;
}
}
\n";
}
returnString += "