org.erif.util
Class HTMLUtil

java.lang.Object
  |
  +--org.erif.util.HTMLUtil

public class HTMLUtil
extends java.lang.Object

a grab bag of html niftiness. mainly used for clean(), newlineToBR(), newlineToLI(), and makeSelectList()


Constructor Summary
HTMLUtil()
           
 
Method Summary
static java.lang.String clean(java.lang.String text)
          removes open brackets from text, neutralizing any HTML present
static java.lang.String encode(java.lang.String text)
           
static java.lang.String getReferrer(javax.servlet.http.HttpServletRequest req)
          returns referring page as String from HTTPServletRequest
static java.lang.String getRemoteAddr(javax.servlet.http.HttpServletRequest req)
          returns remote ip as String from HTTPServletRequest
static java.lang.String makeMultiSelectList(java.lang.String name, java.lang.String[][] hash)
          Provides HTML for a multiselect box containing the items in the parameters
static java.lang.String makeMultiSelectList(java.lang.String name, java.lang.String[][] hash, java.lang.String[] chosen)
          Provides HTML for a multiselect box containing the items in the parameters; automatically defaults to previously selected statement
static java.lang.String makeSelectList(java.lang.String name, int[] hash, int chosen)
          Provides HTML for a select box containing the items in the parameters; automatically defaults to previously selected statement
static java.lang.String makeSelectList(java.lang.String name, java.lang.String[][] hash, java.lang.String chosen)
          Provides HTML for a select box containing the items in the parameters; automatically defaults to previously selected statement
static java.lang.String makeSelectList(java.lang.String name, java.lang.String[][] hash, java.lang.String chosen, java.lang.String prompt)
          Provides HTML for a select box containing the items in the parameters; automatically defaults to previously selected statement
static java.lang.String makeSelectList(java.lang.String name, java.lang.String[] hash, java.lang.String chosen)
          Provides HTML for a select box containing the items in the parameters; automatically defaults to previously selected statement
static java.lang.String newlineToBR(java.lang.String text)
          replaces newlines with <BR>'s
static java.lang.String newlineToLI(java.lang.String text)
          replaces newlines with <BR>'s
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HTMLUtil

public HTMLUtil()
Method Detail

getRemoteAddr

public static java.lang.String getRemoteAddr(javax.servlet.http.HttpServletRequest req)
returns remote ip as String from HTTPServletRequest

getReferrer

public static java.lang.String getReferrer(javax.servlet.http.HttpServletRequest req)
returns referring page as String from HTTPServletRequest

clean

public static java.lang.String clean(java.lang.String text)
removes open brackets from text, neutralizing any HTML present
Parameters:
text - text to be cleaned
Returns:
cleaned text

encode

public static java.lang.String encode(java.lang.String text)

newlineToBR

public static java.lang.String newlineToBR(java.lang.String text)
replaces newlines with <BR>'s
Parameters:
text - text to be displayed
Returns:
HTMLized text, ish

newlineToLI

public static java.lang.String newlineToLI(java.lang.String text)
replaces newlines with <BR>'s
Parameters:
text - text to be displayed
Returns:
<li> tags wrapped around said items.

makeSelectList

public static java.lang.String makeSelectList(java.lang.String name,
                                              java.lang.String[][] hash,
                                              java.lang.String chosen,
                                              java.lang.String prompt)
Provides HTML for a select box containing the items in the parameters; automatically defaults to previously selected statement
Parameters:
name - name of select box for use in parameters
hash - object array containing key/value pairs
chosen - value to be used as default SELECTED
prompt - display text for unselected list (or null for none)
Returns:
HTML string containing select box

makeSelectList

public static java.lang.String makeSelectList(java.lang.String name,
                                              java.lang.String[][] hash,
                                              java.lang.String chosen)
Provides HTML for a select box containing the items in the parameters; automatically defaults to previously selected statement
Parameters:
name - name of select box for use in parameters
hash - object array containing key/value pairs
chosen - value to be used as default SELECTED
Returns:
HTML string containing select box

makeSelectList

public static java.lang.String makeSelectList(java.lang.String name,
                                              int[] hash,
                                              int chosen)
Provides HTML for a select box containing the items in the parameters; automatically defaults to previously selected statement
Parameters:
name - name of select box for use in parameters
hash - int array containing numeric values (key/value are the same)
chosen - value to be used as default SELECTED
Returns:
HTML string containing select box

makeSelectList

public static java.lang.String makeSelectList(java.lang.String name,
                                              java.lang.String[] hash,
                                              java.lang.String chosen)
Provides HTML for a select box containing the items in the parameters; automatically defaults to previously selected statement
Parameters:
name - name of select box for use in parameters
hash - String array containing values (key/value are the same)
chosen - value to be used as default SELECTED
Returns:
HTML string containing select box

makeMultiSelectList

public static java.lang.String makeMultiSelectList(java.lang.String name,
                                                   java.lang.String[][] hash,
                                                   java.lang.String[] chosen)
Provides HTML for a multiselect box containing the items in the parameters; automatically defaults to previously selected statement
Parameters:
name - name of select box for use in parameters
hash - object array containing key/value pairs
chosen - value(s) to be used as default SELECTED
Returns:
HTML string containing select box

makeMultiSelectList

public static java.lang.String makeMultiSelectList(java.lang.String name,
                                                   java.lang.String[][] hash)
Provides HTML for a multiselect box containing the items in the parameters
Parameters:
name - name of select box for use in parameters
hash - object array containing key/value pairs
Returns:
HTML string containing select box


Copyright © 2003 - kaolin fire