net.sourceforge.stripes.util
Class HtmlUtil

java.lang.Object
  extended by net.sourceforge.stripes.util.HtmlUtil

public class HtmlUtil
extends Object

Provides simple utility methods for dealing with HTML.

Author:
Tim Fennell

Constructor Summary
HtmlUtil()
           
 
Method Summary
static String combineValues(Collection<String> values)
          One of a pair of methods (the other is splitValues) that is used to combine several un-encoded values into a single delimited, encoded value for placement into a hidden field.
static String encode(String fragment)
          Replaces special HTML characters from the set [<, >, ", ', &] with their HTML escape codes.
static Collection<String> splitValues(String value)
          Takes in a String produced by combineValues and returns a Collection of values that contains the same values as originally supplied to combineValues.
 
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

encode

public static String encode(String fragment)
Replaces special HTML characters from the set [<, >, ", ', &] with their HTML escape codes. Note that because the escape codes are multi-character that the returned String could be longer than the one passed in.

Parameters:
fragment - a String fragment that might have HTML special characters in it
Returns:
the fragment with special characters escaped

combineValues

public static String combineValues(Collection<String> values)
One of a pair of methods (the other is splitValues) that is used to combine several un-encoded values into a single delimited, encoded value for placement into a hidden field.

Parameters:
values - One or more values which are to be combined
Returns:
a single HTML-encoded String that contains all the values in such a way that they can be converted back into a Collection of Strings with splitValues().

splitValues

public static Collection<String> splitValues(String value)
Takes in a String produced by combineValues and returns a Collection of values that contains the same values as originally supplied to combineValues. Note that the order or items in the collection (and indeed the type of Collection used) are not guaranteed to be the same.

Parameters:
value - a String value produced by
Returns:
a Collection of zero or more Strings


? Copyright 2005-2006, Stripes Development Team.