Class HTMLUtils

java.lang.Object
  |
  +--HTMLUtils

public class HTMLUtils
extends java.lang.Object

HTMLUtils is a collection static methods that can be used to print out HTML constructs such as form widgets and tables. All methods accept PrintWriter objects to print out to.


Constructor Summary
HTMLUtils()
           
 
Method Summary
static void printError(java.io.PrintWriter out, java.lang.String errorMsg)
          Prints out an error message in a new paragraph.
static void printException(java.io.PrintWriter out, java.lang.Exception e)
          Prints out an exception and its stack trace to the HTML page.
static void printExpireTags(java.io.PrintWriter out)
          Prints out meta-tags regcogized by various browsers, telling them not to cache the page.
static void printFooter(java.io.PrintWriter out)
          Prints out a standard footer to an HTML page.
static void printHeader(java.io.PrintWriter out, java.lang.String title)
          Prints out a standard header to an HTML page.
static void printRedirectPage(java.io.PrintWriter out, java.lang.String msg, java.lang.String url)
          Prints out a page that will redirect the user to another page using JavaScript.
static void printSelect(java.io.PrintWriter out, java.lang.String description, java.lang.String name, java.util.HashMap options, java.lang.String defSelection)
          Prints out an HTML form select (Usually rendered natively as a combo box).
static void printTable(java.io.PrintWriter out, java.util.Collection format)
          Prints out an HTML table to an HTML Page.
static void printTextBox(java.io.PrintWriter out, java.lang.String type, java.lang.String description, java.lang.String name, java.lang.String sideText, java.lang.String size, java.lang.String maxSize)
          Prints out an HTML form input object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HTMLUtils

public HTMLUtils()
Method Detail

printExpireTags

public static void printExpireTags(java.io.PrintWriter out)
                            throws java.io.IOException
Prints out meta-tags regcogized by various browsers, telling them not to cache the page.

Parameters:
out - The PrintWriter to print to.
Throws:
java.io.IOException - if an error occurs while writing to the PrintWriter.

printRedirectPage

public static void printRedirectPage(java.io.PrintWriter out,
                                     java.lang.String msg,
                                     java.lang.String url)
                              throws java.io.IOException
Prints out a page that will redirect the user to another page using JavaScript.

Parameters:
out - The PrintWriter to print to.
msg - A message to display to the user specific to why a redirection is occuring.
url - The absolute or relative path to redirect the user to.
Throws:
java.io.IOException - if an error occurs while writing to the PrintWriter.

printHeader

public static void printHeader(java.io.PrintWriter out,
                               java.lang.String title)
                        throws java.io.IOException
Prints out a standard header to an HTML page. Used to print out the same header on each page of the advisement system.

Parameters:
out - The PrintWriter to print to.
title - A message to display in the title bar of the browser.
Throws:
java.io.IOException - if an error occurs while writing to the PrintWriter.

printTable

public static void printTable(java.io.PrintWriter out,
                              java.util.Collection format)
                       throws java.io.IOException
Prints out an HTML table to an HTML Page. See the system documentation on the frontend for an explaination of how to use this method.

Parameters:
out - The PrintWriter to print to.
format - A collection of String objects. See system documentation for details.
Throws:
java.io.IOException - if an error occurs while writing to the PrintWriter.

printSelect

public static void printSelect(java.io.PrintWriter out,
                               java.lang.String description,
                               java.lang.String name,
                               java.util.HashMap options,
                               java.lang.String defSelection)
                        throws java.io.IOException
Prints out an HTML form select (Usually rendered natively as a combo box).

Parameters:
out - The PrintWriter to print to.
description - A message to be displayed on top of the select object.
name - The name field of the select object.
options - A HashMap mapping option names to values.
defSelection - The option selected by default (this can be null).
Throws:
java.io.IOException - if an error occurs while writing to the PrintWriter.

printTextBox

public static void printTextBox(java.io.PrintWriter out,
                                java.lang.String type,
                                java.lang.String description,
                                java.lang.String name,
                                java.lang.String sideText,
                                java.lang.String size,
                                java.lang.String maxSize)
                         throws java.io.IOException
Prints out an HTML form input object. Type is selectable by parameter.

Parameters:
out - The PrintWriter to print to.
type - The type of the input object (ex. text, password, button, etc.)
description - A message to appear on top of the input object.
name - The name field of the input object.
sideText - A String to appear on the side of the input object. (can be null)
size - the number of characters wide the input object is.
maxSize - the maximum number of characters allowed to be entered.
Throws:
java.io.IOException - if an error occurs while writing to the PrintWriter.

printFooter

public static void printFooter(java.io.PrintWriter out)
                        throws java.io.IOException
Prints out a standard footer to an HTML page. Used to print out the same footer on each page of the advisement system.

Parameters:
out - The PrintWriter to print to.
Throws:
java.io.IOException - if an error occurs while writing to the PrintWriter.

printError

public static void printError(java.io.PrintWriter out,
                              java.lang.String errorMsg)
                       throws java.io.IOException
Prints out an error message in a new paragraph.

Parameters:
out - The PrintWriter to print to.
errorMsg - The message to print.
Throws:
java.io.IOException - if an error occurs while writing to the PrintWriter.

printException

public static void printException(java.io.PrintWriter out,
                                  java.lang.Exception e)
                           throws java.io.IOException
Prints out an exception and its stack trace to the HTML page.

Parameters:
out - The PrintWriter to print to.
e - the exception to print.
Throws:
java.io.IOException - if an error occurs while writing to the PrintWriter.