Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## ccl.servlet
Class HTML

    java.lang.Object
      |
      +--ccl.servlet.HTML

public class HTML
extends java.lang.Object

This class encapsulates printing of html code in a very basic way without any fancy output support.

Constructor Summary
`HTML(javax.servlet.http.HttpServletResponse response_)` All following output goes to the given HttpServletResponse object.
`HTML(java.io.PrintWriter writer)` All following output goes to the given writer object.
`HTML(java.io.Writer writer)` All following output goes to the given writer object.

Method Summary
`void` | `close()` This method prints a closing body and html tag.
`void` | `endDataTableLine()` Table methods provide a service where the user can just add new value entries to the table, specify when a line is finished etc.
`void` | `endTableLine()` Table methods provide a service where the user can just add new value entries to the table, specify when a line is finished etc.
`static void` | `exportCSV(javax.servlet.http.HttpServletResponse response, java.sql.ResultSet result)` This method does not print html output but instead creates a csv file which can be used to import into a spread sheet application like Excel or StarCalc.
`static HTML` | `getDummyHTML()` Create a dummy html object useful for testing.
`void` | `print(java.lang.String sHTML_)` This method prints the given string unfiltered as html without any html formatting.
`void` | `printBR()` Prints a tag.
`void` | `printBR(java.lang.String sText)` Prints the text and adds a tag.
`void` | `printDataTableHeader(java.lang.String header)` Add header entry to table.
`void` | `printDataTableHeader(java.lang.String header, java.lang.String align)` Add header entry to table.
`void` | `printDataTableHeader(java.lang.String header, java.lang.String align, int colspan)` Add header entry to table.
`void` | `printDataTableStart(java.lang.String headerBGColor, java.lang.String secondBGColor)` Table methods provide a service where the user can just add new value entries to the table, specify when a line is finished etc.
`void` | `printDataTableValue(java.lang.String value)` Add value entry to table.
`void` | `printDataTableValue(java.lang.String value, java.lang.String align)` Add value entry to table.
`void` | `printDataTableValue(java.lang.String value, java.lang.String align, int colspan)` Add value entry to table.
`void` | `printFormularHidden(java.lang.String sName_, java.lang.String sValue_)` This method prints an input tag with hidden data.
`void` | `printFormularOperationMode()` Let the user select if the formular entry should be use in "add", "change", or "delete" mode.
`void` | `printFormularSelection(java.lang.String sMessage_, java.lang.String sName_, java.lang.String[] asValue_, java.lang.String sDefault_)` This method prints a formular select tag with the given values.
`void` | `printFormularSelection(java.lang.String sMessage_, java.lang.String sName_, java.lang.String[] asValue_, java.lang.String[] asRepresentation_)` This method prints a formular select tag with the given values.
`void` | `printFormularSelection(java.lang.String sMessage_, java.lang.String sName_, java.lang.String[] asValue_, java.lang.String[] asRepresentation_, java.lang.String sDefaultValue_)` This method prints a formular select tag with the given values.
`void` | `printFormularSelection(java.lang.String sMessage_, java.lang.String sName_, java.lang.String sSqlQuery_, java.lang.String sDefaultValue_, java.sql.Statement statement_)` This method prints a formular select tag.
`void` | `printFormularSelection(java.lang.String sMessage_, java.lang.String sName_, java.util.Vector vValues_, java.util.Vector vRepresentations_, java.lang.String sDefaultValue_)` This method prints a formular select tag with the given values.
`void` | `printFormularStart(java.lang.String sMethod_, java.lang.String sAction_)` This method prints the start tag of an html formular.
`void` | `printFormularSubmit()` This method prints a submit button for use in an html formular.
`void` | `printFormularSubmit(java.lang.String label)` This method prints a submit button for use in an html formular.
`void` | `printFormularTextArea(java.lang.String sMessage_, java.lang.String sName_, java.lang.String sDefault_)` Adds a text area to the formular.
`void` | `printFormularTextInput(java.lang.String sMessage_, java.lang.String sName_)` This method prints a text input tag.
`void` | `printFormularTextInput(java.lang.String sMessage_, java.lang.String sName_, java.lang.String sDefault_)` This method prints a text input tag.
`void` | `printFormularTextInput(java.lang.String sMessage_, java.lang.String sName_, java.lang.String sDefault_, int size)` This method prints a text input tag.
`void` | `printLink(java.lang.String sText, java.lang.String sURL)` Prints an html link to the page.
`void` | `println(java.lang.String sLine_)` This method prints the given string unfiltered as html without any html formatting.
`void` | `printP()` Prints a
`void` | `printP(java.lang.String sText)` Prints the text and adds a
`void` | `printResultSet(java.lang.String headerBGColor, java.lang.String secondBGColor, java.sql.ResultSet result)` Prints the content of a jdbc result set via a data table.
`void` | `printTableEnd()` Table methods provide a service where the user can just add new value entries to the table, specify when a line is finished etc.
`void` | `printTableStart()` Table methods provide a service where the user can just add new value entries to the table, specify when a line is finished etc.
`void` | `printTableValue(java.lang.String value)` Table methods provide a service where the user can just add new value entries to the table, specify when a line is finished etc.
`void` | `printTableValue(java.lang.String value, java.lang.String align)` Table methods provide a service where the user can just add new value entries to the table, specify when a line is finished etc.
`void` | `printTitle(java.lang.String sTitle_)` This method prints a title, closes the html head section, starts the body section, and prints an h1 section with the same text as the title.
`void` | `printTitle(java.lang.String sTitle_, java.lang.String bgcolor)` This method prints a title, closes the html head section, starts the body section, and prints an h1 section with the same text as the title.
`void` | `printTitle(java.lang.String title, java.lang.String bgcolor, java.lang.String textcolor)` This method prints a title, closes the html head section, starts the body section, and prints an h1 section with the same text as the title.
`void` | `printTitle(java.lang.String title, java.lang.String bgcolor, java.lang.String textcolor, java.lang.String linkcolor, java.lang.String vlinkcolor)` This method prints a title, closes the html head section, starts the body section, and prints an h1 section with the same text as the title.
`static java.lang.String` | `spacify(java.lang.String value)` Return " " in case the given value is null or an empty string, otherwise the given value is returned.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### HTML

    public HTML(javax.servlet.http.HttpServletResponse response_)
         throws java.io.IOException

  All following output goes to the given HttpServletResponse object. The content type is set immediately to text/html and a html and head section is opened as well. Use the close method on this object to finish the html page. To 'close' the already open head section make sure you printed a title with 'printTitle'.

Throws:
  `java.io.IOException` - in case no print writer could be created from the response object.

### HTML

    public HTML(java.io.Writer writer)

  All following output goes to the given writer object. Use the close method on this object to finish the html page. To 'close' the already open head section make sure you printed a title with 'printTitle'.

### HTML

    public HTML(java.io.PrintWriter writer)

  All following output goes to the given writer object. Use the close method on this object to finish the html page. To 'close' the already open head section make sure you printed a title with 'printTitle'.

Method Detail

### getDummyHTML

    public static HTML getDummyHTML()

  Create a dummy html object useful for testing.

### printTitle

    public void printTitle(java.lang.String sTitle_)

  This method prints a title, closes the html head section, starts the body section, and prints an h1 section with the same text as the title.

### printTitle

    public void printTitle(java.lang.String sTitle_,
                           java.lang.String bgcolor)

  This method prints a title, closes the html head section, starts the body section, and prints an h1 section with the same text as the title.

### printTitle

    public void printTitle(java.lang.String title,
                           java.lang.String bgcolor,
                           java.lang.String textcolor)

  This method prints a title, closes the html head section, starts the body section, and prints an h1 section with the same text as the title.

  Parameters:
    `title` - the title string to print.
    `bgcolor` - the background color of the web page. Use standard HTML syntax like "#ffffff".
    `textcolor` - the foreground color of the web page. Use standard HTML syntax like "#000000".

### printTitle

    public void printTitle(java.lang.String title,
                           java.lang.String bgcolor,
                           java.lang.String textcolor,
                           java.lang.String linkcolor,
                           java.lang.String vlinkcolor)

  This method prints a title, closes the html head section, starts the body section, and prints an h1 section with the same text as the title.

  Parameters:
    `title` - the title string to print.
    `bgcolor` - the background color of the web page. Use standard HTML syntax like "#ffffff".
    `textcolor` - the foreground color of the web page. Use standard HTML syntax like "#000000".
    `linkcolor` - the color used for new links.
    `vlinkcolor` - the color used for visited links.

### print

    public void print(java.lang.String sHTML_)

  This method prints the given string unfiltered as html without any html formatting.

### println

    public void println(java.lang.String sLine_)

  This method prints the given string unfiltered as html without any html formatting. But an '\n' character is added to the text for better readability in the html source code.

### printBR

    public void printBR()

  Prints a
  tag.

### printBR

    public void printBR(java.lang.String sText)

  Prints the text and adds a
  tag.

### printP

    public void printP()

  Prints a

  tag.

### printP

    public void printP(java.lang.String sText)

  Prints the text and adds a

  tag.

### printFormularStart

    public void printFormularStart(java.lang.String sMethod_,
                                   java.lang.String sAction_)

  This method prints the start tag of an html formular. All following text input fields etc. will be aligned using an html table under the hood.

### printFormularHidden

    public void printFormularHidden(java.lang.String sName_,
                                    java.lang.String sValue_)

  This method prints an input tag with hidden data.

### printFormularTextInput

    public void printFormularTextInput(java.lang.String sMessage_,
                                       java.lang.String sName_)

  This method prints a text input tag.

### printFormularTextArea

    public void printFormularTextArea(java.lang.String sMessage_,
                                      java.lang.String sName_,
                                      java.lang.String sDefault_)

  Adds a text area to the formular.

### printFormularTextInput

    public void printFormularTextInput(java.lang.String sMessage_,
                                       java.lang.String sName_,
                                       java.lang.String sDefault_,
                                       int size)

  This method prints a text input tag.

### printFormularTextInput

    public void printFormularTextInput(java.lang.String sMessage_,
                                       java.lang.String sName_,
                                       java.lang.String sDefault_)

  This method prints a text input tag.

### printFormularSelection

    public void printFormularSelection(java.lang.String sMessage_,
                                       java.lang.String sName_,
                                       java.lang.String[] asValue_,
                                       java.lang.String sDefault_)

  This method prints a formular select tag with the given values.

### printFormularSelection

    public void printFormularSelection(java.lang.String sMessage_,
                                       java.lang.String sName_,
                                       java.lang.String[] asValue_,
                                       java.lang.String[] asRepresentation_,
                                       java.lang.String sDefaultValue_)

  This method prints a formular select tag with the given values.

### printFormularSelection

    public void printFormularSelection(java.lang.String sMessage_,
                                       java.lang.String sName_,
                                       java.lang.String[] asValue_,
                                       java.lang.String[] asRepresentation_)

  This method prints a formular select tag with the given values.

### printFormularSelection

    public void printFormularSelection(java.lang.String sMessage_,
                                       java.lang.String sName_,
                                       java.util.Vector vValues_,
                                       java.util.Vector vRepresentations_,
                                       java.lang.String sDefaultValue_)

  This method prints a formular select tag with the given values.

### printFormularSelection

    public void printFormularSelection(java.lang.String sMessage_,
                                       java.lang.String sName_,
                                       java.lang.String sSqlQuery_,
                                       java.lang.String sDefaultValue_,
                                       java.sql.Statement statement_)
                                throws java.sql.SQLException

  This method prints a formular select tag. SQL query must return a result set with 'id' and 'name' columns.

  Throws:
    `java.sql.SQLException` - if the db query fails.

### printFormularOperationMode

    public void printFormularOperationMode()

  Let the user select if the formular entry should be use in "add", "change", or "delete" mode. The name of the field is "operation_mode". Three different submit buttons are used.

### printFormularSubmit

    public void printFormularSubmit()

  This method prints a submit button for use in an html formular. The form gets closed as well.

### printFormularSubmit

    public void printFormularSubmit(java.lang.String label)

  This method prints a submit button for use in an html formular. The form gets closed as well.

  Parameters:
    `label` - a name or label which appears on the submit button.

### printLink

    public void printLink(java.lang.String sText,
                          java.lang.String sURL)

  Prints an html link to the page.

### printTableStart

    public void printTableStart()

  Table methods provide a service where the user can just add new value entries to the table, specify when a line is finished etc. without having to deal with table tags.

### printTableValue

    public void printTableValue(java.lang.String value)

  Table methods provide a service where the user can just add new value entries to the table, specify when a line is finished etc. without having to deal with table tags.

### printTableValue

    public void printTableValue(java.lang.String value,
                                java.lang.String align)

  Table methods provide a service where the user can just add new value entries to the table, specify when a line is finished etc. without having to deal with table tags.

### endTableLine

    public void endTableLine()

  Table methods provide a service where the user can just add new value entries to the table, specify when a line is finished etc. without having to deal with table tags.

### printTableEnd

    public void printTableEnd()

  Table methods provide a service where the user can just add new value entries to the table, specify when a line is finished etc. without having to deal with table tags.

### printDataTableStart

    public void printDataTableStart(java.lang.String headerBGColor,
                                    java.lang.String secondBGColor)

  Table methods provide a service where the user can just add new value entries to the table, specify when a line is finished etc. without having to deal with table tags. The difference to the simple printTableStart and accompanying methods is that this one uses a different color for every second row and has also a background color for the headers.

### printDataTableHeader

    public void printDataTableHeader(java.lang.String header)

  Add header entry to table.

### printDataTableHeader

    public void printDataTableHeader(java.lang.String header,
                                     java.lang.String align)

  Add header entry to table.

### printDataTableHeader

    public void printDataTableHeader(java.lang.String header,
                                     java.lang.String align,
                                     int colspan)

  Add header entry to table.

### printDataTableValue

    public void printDataTableValue(java.lang.String value)

  Add value entry to table.

### printDataTableValue

    public void printDataTableValue(java.lang.String value,
                                    java.lang.String align)

  Add value entry to table.

### printDataTableValue

    public void printDataTableValue(java.lang.String value,
                                    java.lang.String align,
                                    int colspan)

  Add value entry to table.

### endDataTableLine

    public void endDataTableLine()

  Table methods provide a service where the user can just add new value entries to the table, specify when a line is finished etc. without having to deal with table tags.

### printResultSet

    public void printResultSet(java.lang.String headerBGColor,
                               java.lang.String secondBGColor,
                               java.sql.ResultSet result)
                        throws java.sql.SQLException

  Prints the content of a jdbc result set via a data table.

  Parameters:
    `headerBGColor` - HTML color scheme for background for table header backround, for example "#ffcc00".
    `secondBGColor` - HTML color scheme for background of every second data row, for example "#c8c8c8".
  Throws:
    `java.sql.SQLException` - if accessing db meta data fails this exception is thrown.

### close

    public void close()

  This method prints a closing body and html tag. The should be no following invokation on this object.

### spacify

    public static java.lang.String spacify(java.lang.String value)

  Return " " in case the given value is null or an empty string, otherwise the given value is returned.

### exportCSV

    public static void exportCSV(javax.servlet.http.HttpServletResponse response,
                                 java.sql.ResultSet result)
                          throws java.io.IOException,
                                 java.sql.SQLException

  This method does not print html output but instead creates a csv file which can be used to import into a spread sheet application like Excel or StarCalc. The data is taken from the given result set.

  Throws:
    `java.io.IOException` - in case anything goes wrong writing output to the http servlet response.
    `java.sql.SQLException` - in case anything goes wrong with the database.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD