com.oopreserch.web
Class EscapeForHtml
java.lang.Object
|
+--com.oopreserch.web.EscapeForHtml
- All Implemented Interfaces:
- FormValueEscaper
- public class EscapeForHtml
- extends java.lang.Object
- implements FormValueEscaper
The implementation of FormValueEscaper interface.
Replace the special characters with the escaped ones.
If the String with the special characters (such as
< or >) is inserted into the
HTML tags, the concatenated String will be invalid
as the HTML tags.
To avoid this kind of problems, the String should be
escaped before it is inserted into the HTML tags.
This class replaces the special characters for HTML.
The table below lists the special characters and their
corresponding escaped characters:
| Original Character |
Escaped Character |
| < |
< |
| > |
> |
| & |
& |
The implementations for HDML, XML and WML are also included
in this package. They are:
All the available implementations of this interface must be
defined in:
- (docBase)/WEB-INF/classes/FormValueEscaperFactory.properties
In this property resource file, the value is the fully
qualified class name of each implementation.
The corresponding key is the arbitrary String, and you can
specify it as the value of escape.type
attribute in d.value element in the XML.
For details about this property resource file, please look
into FormValueEscaperFactory.
- Author:
- Jun Inamori
|
Method Summary |
java.lang.String |
getEscaped(java.lang.String org)
Escape the special characters for HTML. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
EscapeForHtml
public EscapeForHtml()
getEscaped
public java.lang.String getEscaped(java.lang.String org)
- Escape the special characters for HTML.
- Specified by:
getEscaped in interface FormValueEscaper
- Parameters:
org - The original String
- Returns:
- The escaped String
ALL CONTENTS COPYRIGHT 2002, Jun Inamori. All rights reserved.
Any questions and comments are welcome to Jun Inamori.