| |
| |
| <html> |
| <head> |
| <title>Velocity - EscapeTool</title> |
| |
| <meta name="author" value="Shinobu Kawai"/> |
| <meta name="email" value="shinobu@ieee.org" /> |
| <meta name="author" value="Claude Brisson"/> |
| <meta name="email" value="claude.brisson@gmail.com" /> |
| |
| |
| </head> |
| |
| <body bgcolor="#ffffff" text="#000000" link="#525D76" |
| alink="#525D76" vlink="#525D76"> |
| |
| <table border="0" width="100%" cellspacing="4"> |
| |
| <tr><td colspan="2"> |
| |
| <a href="http://jakarta.apache.org/"> |
| <img src="http://jakarta.apache.org/images/jakarta-logo.gif" |
| align="left" alt="The Jakarta Project" border="0"/> |
| </a> |
| |
| |
| |
| <a href="index.html"> |
| <img src="../images/velocitygenerictools.png" align="right" alt="< Velocity Tools - Library >" border="0"/> |
| </a> |
| |
| </td></tr> |
| |
| <tr> |
| <td colspan="2"> |
| <hr noshade="" size="1"/> |
| </td> |
| </tr> |
| |
| <tr> |
| |
| <td width="20%" valign="top" nowrap="true"> |
| |
| <p><strong><a href="../">Velocity Tools</a></strong></p> |
| |
| <p> |
| <strong>Generic Tools</strong> |
| </p> |
| <ul> |
| <li><a href="index.html">Overview</a></li> |
| <li><a href="../index.html#Download">Download</a></li> |
| <li><a href="index.html#Contributions">Contributions</a></li> |
| <li><a href="../javadoc/index.html">Javadoc</a></li> |
| |
| </ul> |
| <p> |
| <strong>Tool Documentation</strong> |
| </p> |
| <ul> |
| <li><a href="../javadoc/org/apache/velocity/tools/generic/DateTool.html">DateTool</a></li> |
| <li><a href="MathTool.html">MathTool</a></li> |
| <li><a href="../javadoc/org/apache/velocity/tools/generic/NumberTool.html">NumberTool</a></li> |
| <li><a href="RenderTool.html">RenderTool</a></li> |
| <li><a href="EscapeTool.html">EscapeTool</a></li> |
| <li><a href="../javadoc/org/apache/velocity/tools/generic/ResourceTool.html">ResourceTool</a></li> |
| <li><a href="../javadoc/org/apache/velocity/tools/generic/Alternator.html">Alternator</a></li> |
| <li><a href="../javadoc/org/apache/velocity/tools/generic/AlternatorTool.html">AlternatorTool</a></li> |
| <li><a href="../javadoc/org/apache/velocity/tools/generic/ValueParser.html">ValueParser</a></li> |
| <li><a href="../javadoc/org/apache/velocity/tools/generic/ListTool.html">ListTool</a></li> |
| <li><a href="../javadoc/org/apache/velocity/tools/generic/SortTool.html">SortTool</a></li> |
| <li><a href="../javadoc/org/apache/velocity/tools/generic/IteratorTool.html">IteratorTool</a></li> |
| |
| </ul> |
| <p> |
| <strong>Other Subprojects</strong> |
| </p> |
| <ul> |
| <li><a href="../view/">VelocityView</a></li> |
| <li><a href="../struts/">VelocityStruts</a></li> |
| |
| </ul> |
| |
| <p> |
| </p> |
| |
| </td> |
| |
| <!-- RIGHT SIDE MAIN BODY --> |
| <td colspan="1" valign="top" align="left"> |
| <table border="0" cellspacing="0" cellpadding="2" width="100%"> |
| <tr> |
| <td colspan="2" bgcolor="#525D76"> |
| <font color="#ffffff" face="arial,helvetica.sanserif"> |
| <a name="EscapeTool Reference Documentation"> |
| <strong>EscapeTool Reference Documentation</strong></a></font> |
| </td> |
| </tr> |
| <tr> |
| <td NOWRAP> </td> |
| <td> |
| <p>Tool for working with escaping in Velocity templates.</p> |
| <p> |
| It provides methods to escape outputs for Java, JavaScript, HTML, XML and SQL. |
| Also provides methods to render VTL characters that otherwise needs escaping. |
| </p> |
| <table cellpadding="0" cellspacing="0"> |
| <tr><td colspan="2"><strong>Class</strong></td></tr> |
| <tr><td> </td><td>org.apache.velocity.tools.generic.EscapeTool</td></tr> |
| |
| <tr><td colspan="2"><strong>Name</strong></td></tr> |
| <tr><td> </td><td>$esc (this is the recommended name of the tool in |
| the Velocity context)</td></tr> |
| |
| <tr><td colspan="2"><strong>Toolbox Configuration Example</strong></td></tr> |
| <tr><td> </td><td><pre><tool> |
| <key>esc</key> |
| <scope>application</scope> |
| <class>org.apache.velocity.tools.generic.EscapeTool</class> |
| </tool></pre></td></tr> |
| |
| <tr><td colspan="2"><strong>Author(s)</strong></td></tr> |
| <tr> |
| <td> </td> |
| <td><a href="mailto:shinobu@ieee.org">Shinobu Kawai</a><br></td> |
| </tr> |
| </table> |
| <dl> |
| <dt><strong>Method Overview</strong></dt> |
| <dd> |
| <table cellpadding="2" cellspacing="2" border="0"> |
| <tr> |
| <td bgcolor="EEEEEE" nowrap> |
| <a href="#java()">java()</a></td> |
| <td bgcolor="EEEEEE"> |
| |
| Escapes the characters in a <code>String</code> using Java String rules. |
| |
| </td> |
| </tr> |
| <tr> |
| <td bgcolor="EEEEEE" nowrap> |
| <a href="#javascript()">javascript()</a></td> |
| <td bgcolor="EEEEEE"> |
| |
| Escapes the characters in a <code>String</code> using JavaScript String rules. |
| |
| </td> |
| </tr> |
| <tr> |
| <td bgcolor="EEEEEE" nowrap> |
| <a href="#html()">html()</a></td> |
| <td bgcolor="EEEEEE"> |
| |
| Escapes the characters in a <code>String</code> using HTML entities. |
| |
| </td> |
| </tr> |
| <tr> |
| <td bgcolor="EEEEEE" nowrap> |
| <a href="#url()">url()</a></td> |
| <td bgcolor="EEEEEE"> |
| |
| Escapes the characters in a <code>String</code> to be suitable to use as an HTTP parameter value. |
| |
| </td> |
| </tr> |
| <tr> |
| <td bgcolor="EEEEEE" nowrap> |
| <a href="#xml()">xml()</a></td> |
| <td bgcolor="EEEEEE"> |
| |
| Escapes the characters in a <code>String</code> using XML entities. |
| |
| </td> |
| </tr> |
| <tr> |
| <td bgcolor="EEEEEE" nowrap> |
| <a href="#sql()">sql()</a></td> |
| <td bgcolor="EEEEEE"> |
| |
| Escapes the characters in a <code>String</code> to be suitable to pass to an SQL query. |
| |
| </td> |
| </tr> |
| <tr> |
| <td bgcolor="EEEEEE" nowrap> |
| <a href="#getDollar()">getDollar()</a></td> |
| <td bgcolor="EEEEEE"> |
| |
| Renders a dollar sign ($). |
| |
| </td> |
| </tr> |
| <tr> |
| <td bgcolor="EEEEEE" nowrap> |
| <a href="#getD()">getD()</a></td> |
| <td bgcolor="EEEEEE"> |
| |
| Renders a dollar sign ($). |
| |
| </td> |
| </tr> |
| <tr> |
| <td bgcolor="EEEEEE" nowrap> |
| <a href="#getHash()">getHash()</a></td> |
| <td bgcolor="EEEEEE"> |
| |
| Renders a hash (#). |
| |
| </td> |
| </tr> |
| <tr> |
| <td bgcolor="EEEEEE" nowrap> |
| <a href="#getH()">getH()</a></td> |
| <td bgcolor="EEEEEE"> |
| |
| Renders a hash (#). |
| |
| </td> |
| </tr> |
| <tr> |
| <td bgcolor="EEEEEE" nowrap> |
| <a href="#getBackslash()">getBackslash()</a></td> |
| <td bgcolor="EEEEEE"> |
| |
| Renders a backslash (\). |
| |
| </td> |
| </tr> |
| <tr> |
| <td bgcolor="EEEEEE" nowrap> |
| <a href="#getB()">getB()</a></td> |
| <td bgcolor="EEEEEE"> |
| |
| Renders a backslash (\). |
| |
| </td> |
| </tr> |
| <tr> |
| <td bgcolor="EEEEEE" nowrap> |
| <a href="#getQuote()">getQuote()</a></td> |
| <td bgcolor="EEEEEE"> |
| |
| Renders a double quotation mark ("). |
| |
| </td> |
| </tr> |
| <tr> |
| <td bgcolor="EEEEEE" nowrap> |
| <a href="#getQ()">getQ()</a></td> |
| <td bgcolor="EEEEEE"> |
| |
| Renders a double quotation mark ("). |
| |
| </td> |
| </tr> |
| <tr> |
| <td bgcolor="EEEEEE" nowrap> |
| <a href="#getSingleQuote()">getSingleQuote()</a></td> |
| <td bgcolor="EEEEEE"> |
| |
| Renders a single quotation mark ('). |
| |
| </td> |
| </tr> |
| <tr> |
| <td bgcolor="EEEEEE" nowrap> |
| <a href="#getS()">getS()</a></td> |
| <td bgcolor="EEEEEE"> |
| |
| Renders a single quotation mark ('). |
| |
| </td> |
| </tr> |
| <tr> |
| <td bgcolor="EEEEEE" nowrap> |
| <a href="#getExclamation()">getExclamation()</a></td> |
| <td bgcolor="EEEEEE"> |
| |
| Renders an exclamation mark (!). |
| |
| </td> |
| </tr> |
| <tr> |
| <td bgcolor="EEEEEE" nowrap> |
| <a href="#getE()">getE()</a></td> |
| <td bgcolor="EEEEEE"> |
| |
| Renders an exclamation mark (!). |
| |
| </td> |
| </tr> |
| </table> |
| </dd> |
| </dl> |
| |
| </td> |
| </tr> |
| </table> |
| <table border="0" cellspacing="0" cellpadding="2" width="100%"> |
| <tr> |
| <td colspan="2" bgcolor="#525D76"> |
| <font color="#ffffff" face="arial,helvetica.sanserif"> |
| <a name="java()"> |
| <strong>java()</strong></a></font> |
| </td> |
| </tr> |
| <tr> |
| <td NOWRAP> </td> |
| <td> |
| |
| <p> |
| <abstract> |
| Escapes the characters in a <code>String</code> using Java String rules. |
| </abstract> |
| </p> |
| <p> |
| <table width="100%"><tr><td bgcolor="EEEEEE"> |
| <font size="+1"><code> |
| <signature> |
| String java(Object string) |
| </signature> |
| </code></font> |
| </td></tr></table> |
| </p> |
| <dl> |
| <dt><strong>Parameters</strong></dt> |
| <dd> |
| <dl> |
| <dt>string</dt> |
| <dd> |
| <parameter name="string"> |
| the string to escape values, may be null. |
| </parameter> |
| </dd> |
| |
| |
| </dl> |
| </dd> |
| </dl> |
| <dl> |
| <dt><strong>Returns</strong></dt> |
| <dd> |
| <returns> |
| String with escaped values, <code>null</code> if null string input. |
| </returns> |
| </dd> |
| </dl> |
| |
| <p>Delegates the process to |
| <a href="http://jakarta.apache.org/commons/lang/api/org/apache/commons/lang/StringEscapeUtils.html#escapeJava(java.lang.String)">StringEscapeUtils#escapeJava(String)</a>. |
| </p> |
| <p>If <code>$java</code> had the following value:</p> |
| <table width="100%" cellpadding="1" cellspacing="0" border="0"><tr><td bgcolor="#000000"> |
| <table width="100%" cellpadding="5" cellspacing="0" border="0"><tr><td bgcolor="#FFFFFF"> |
| <pre><sourcecode>He didn't say, "Stop!"</sourcecode></pre> |
| </td></tr></table> |
| </td></tr></table> |
| <p>then the following Velocity script:</p> |
| <table width="100%" cellpadding="1" cellspacing="0" border="0"><tr><td bgcolor="#000000"> |
| <table width="100%" cellpadding="5" cellspacing="0" border="0"><tr><td bgcolor="#FFFFFF"> |
| <pre><sourcecode>$esc.java($java)</sourcecode></pre> |
| </td></tr></table> |
| </td></tr></table> |
| <p>produces this output:</p> |
| <table width="100%" cellpadding="1" cellspacing="0" border="0"><tr><td bgcolor="#000000"> |
| <table width="100%" cellpadding="5" cellspacing="0" border="0"><tr><td bgcolor="#FFFFFF"> |
| <pre><sourcecode>He didn't say, \"Stop!\"</sourcecode></pre> |
| </td></tr></table> |
| </td></tr></table> |
| |
| |
| <br clear="all"> |
| |
| </td> |
| </tr> |
| </table> |
| <table border="0" cellspacing="0" cellpadding="2" width="100%"> |
| <tr> |
| <td colspan="2" bgcolor="#525D76"> |
| <font color="#ffffff" face="arial,helvetica.sanserif"> |
| <a name="javascript()"> |
| <strong>javascript()</strong></a></font> |
| </td> |
| </tr> |
| <tr> |
| <td NOWRAP> </td> |
| <td> |
| |
| <p> |
| <abstract> |
| Escapes the characters in a <code>String</code> using JavaScript String rules. |
| </abstract> |
| </p> |
| <p> |
| <table width="100%"><tr><td bgcolor="EEEEEE"> |
| <font size="+1"><code> |
| <signature> |
| String javascript(Object string) |
| </signature> |
| </code></font> |
| </td></tr></table> |
| </p> |
| <dl> |
| <dt><strong>Parameters</strong></dt> |
| <dd> |
| <dl> |
| <dt>string</dt> |
| <dd> |
| <parameter name="string"> |
| the string to escape values, may be null. |
| </parameter> |
| </dd> |
| |
| |
| </dl> |
| </dd> |
| </dl> |
| <dl> |
| <dt><strong>Returns</strong></dt> |
| <dd> |
| <returns> |
| String with escaped values, <code>null</code> if null string input. |
| </returns> |
| </dd> |
| </dl> |
| |
| <p>Delegates the process to |
| <a href="http://jakarta.apache.org/commons/lang/api/org/apache/commons/lang/StringEscapeUtils.html#escapeJavaScript(java.lang.String)">StringEscapeUtils#escapeJavaScript(String)</a>. |
| </p> |
| <p>If <code>$javascript</code> had the following value:</p> |
| <table width="100%" cellpadding="1" cellspacing="0" border="0"><tr><td bgcolor="#000000"> |
| <table width="100%" cellpadding="5" cellspacing="0" border="0"><tr><td bgcolor="#FFFFFF"> |
| <pre><sourcecode>He didn't say, "Stop!"</sourcecode></pre> |
| </td></tr></table> |
| </td></tr></table> |
| <p>then the following Velocity script:</p> |
| <table width="100%" cellpadding="1" cellspacing="0" border="0"><tr><td bgcolor="#000000"> |
| <table width="100%" cellpadding="5" cellspacing="0" border="0"><tr><td bgcolor="#FFFFFF"> |
| <pre><sourcecode>$esc.javascript($javascript)</sourcecode></pre> |
| </td></tr></table> |
| </td></tr></table> |
| <p>produces this output:</p> |
| <table width="100%" cellpadding="1" cellspacing="0" border="0"><tr><td bgcolor="#000000"> |
| <table width="100%" cellpadding="5" cellspacing="0" border="0"><tr><td bgcolor="#FFFFFF"> |
| <pre><sourcecode>He didn\'t say, \"Stop!\"</sourcecode></pre> |
| </td></tr></table> |
| </td></tr></table> |
| |
| |
| <br clear="all"> |
| |
| </td> |
| </tr> |
| </table> |
| <table border="0" cellspacing="0" cellpadding="2" width="100%"> |
| <tr> |
| <td colspan="2" bgcolor="#525D76"> |
| <font color="#ffffff" face="arial,helvetica.sanserif"> |
| <a name="html()"> |
| <strong>html()</strong></a></font> |
| </td> |
| </tr> |
| <tr> |
| <td NOWRAP> </td> |
| <td> |
| |
| <p> |
| <abstract> |
| Escapes the characters in a <code>String</code> using HTML entities. |
| </abstract> |
| </p> |
| <p> |
| <table width="100%"><tr><td bgcolor="EEEEEE"> |
| <font size="+1"><code> |
| <signature> |
| String html(Object string) |
| </signature> |
| </code></font> |
| </td></tr></table> |
| </p> |
| <dl> |
| <dt><strong>Parameters</strong></dt> |
| <dd> |
| <dl> |
| <dt>string</dt> |
| <dd> |
| <parameter name="string"> |
| the string to escape values, may be null. |
| </parameter> |
| </dd> |
| |
| |
| </dl> |
| </dd> |
| </dl> |
| <dl> |
| <dt><strong>Returns</strong></dt> |
| <dd> |
| <returns> |
| a new escaped <code>String</code>, <code>null</code> if null string input |
| </returns> |
| </dd> |
| </dl> |
| |
| <p>Delegates the process to |
| <a href="http://jakarta.apache.org/commons/lang/api/org/apache/commons/lang/StringEscapeUtils.html#escapeHtml(java.lang.String)">StringEscapeUtils#escapeHtml(String)</a>. |
| </p> |
| <p>If <code>$html</code> had the following value:</p> |
| <table width="100%" cellpadding="1" cellspacing="0" border="0"><tr><td bgcolor="#000000"> |
| <table width="100%" cellpadding="5" cellspacing="0" border="0"><tr><td bgcolor="#FFFFFF"> |
| <pre><sourcecode>"bread" & "butter"</sourcecode></pre> |
| </td></tr></table> |
| </td></tr></table> |
| <p>then the following Velocity script:</p> |
| <table width="100%" cellpadding="1" cellspacing="0" border="0"><tr><td bgcolor="#000000"> |
| <table width="100%" cellpadding="5" cellspacing="0" border="0"><tr><td bgcolor="#FFFFFF"> |
| <pre><sourcecode>$esc.html($html)</sourcecode></pre> |
| </td></tr></table> |
| </td></tr></table> |
| <p>produces this output:</p> |
| <table width="100%" cellpadding="1" cellspacing="0" border="0"><tr><td bgcolor="#000000"> |
| <table width="100%" cellpadding="5" cellspacing="0" border="0"><tr><td bgcolor="#FFFFFF"> |
| <pre><sourcecode>&quot;bread&quot; &amp; &quot;butter&quot;</sourcecode></pre> |
| </td></tr></table> |
| </td></tr></table> |
| |
| |
| <br clear="all"> |
| |
| </td> |
| </tr> |
| </table> |
| <table border="0" cellspacing="0" cellpadding="2" width="100%"> |
| <tr> |
| <td colspan="2" bgcolor="#525D76"> |
| <font color="#ffffff" face="arial,helvetica.sanserif"> |
| <a name="url()"> |
| <strong>url()</strong></a></font> |
| </td> |
| </tr> |
| <tr> |
| <td NOWRAP> </td> |
| <td> |
| |
| <p> |
| <abstract> |
| Escapes the characters in a <code>String</code> to be suitable to use as an HTTP parameter value. |
| </abstract> |
| </p> |
| <p> |
| <table width="100%"><tr><td bgcolor="EEEEEE"> |
| <font size="+1"><code> |
| <signature> |
| String url(Object string) |
| </signature> |
| </code></font> |
| </td></tr></table> |
| </p> |
| <dl> |
| <dt><strong>Parameters</strong></dt> |
| <dd> |
| <dl> |
| <dt>string</dt> |
| <dd> |
| <parameter name="string"> |
| the string to escape values, may be null. |
| </parameter> |
| </dd> |
| |
| |
| </dl> |
| </dd> |
| </dl> |
| <dl> |
| <dt><strong>Returns</strong></dt> |
| <dd> |
| <returns> |
| a new escaped <code>String</code>, <code>null</code> if null string input |
| </returns> |
| </dd> |
| </dl> |
| |
| <p>Delegates the process to |
| <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/net/URLEncoder.html">java.net.URLEncoder#encodeURL(String,"UTF-8")</a>. |
| </p> |
| <p>If <code>$http</code> had the following value:</p> |
| <table width="100%" cellpadding="1" cellspacing="0" border="0"><tr><td bgcolor="#000000"> |
| <table width="100%" cellpadding="5" cellspacing="0" border="0"><tr><td bgcolor="#FFFFFF"> |
| <pre><sourcecode>Hello here & there</sourcecode></pre> |
| </td></tr></table> |
| </td></tr></table> |
| <p>then the following Velocity script:</p> |
| <table width="100%" cellpadding="1" cellspacing="0" border="0"><tr><td bgcolor="#000000"> |
| <table width="100%" cellpadding="5" cellspacing="0" border="0"><tr><td bgcolor="#FFFFFF"> |
| <pre><sourcecode>$esc.url($http)</sourcecode></pre> |
| </td></tr></table> |
| </td></tr></table> |
| <p>produces this output:</p> |
| <table width="100%" cellpadding="1" cellspacing="0" border="0"><tr><td bgcolor="#000000"> |
| <table width="100%" cellpadding="5" cellspacing="0" border="0"><tr><td bgcolor="#FFFFFF"> |
| <pre><sourcecode>hello+here+%26+there</sourcecode></pre> |
| </td></tr></table> |
| </td></tr></table> |
| |
| |
| <br clear="all"> |
| |
| </td> |
| </tr> |
| </table> |
| <table border="0" cellspacing="0" cellpadding="2" width="100%"> |
| <tr> |
| <td colspan="2" bgcolor="#525D76"> |
| <font color="#ffffff" face="arial,helvetica.sanserif"> |
| <a name="xml()"> |
| <strong>xml()</strong></a></font> |
| </td> |
| </tr> |
| <tr> |
| <td NOWRAP> </td> |
| <td> |
| |
| <p> |
| <abstract> |
| Escapes the characters in a <code>String</code> using XML entities. |
| </abstract> |
| </p> |
| <p> |
| <table width="100%"><tr><td bgcolor="EEEEEE"> |
| <font size="+1"><code> |
| <signature> |
| String xml(Object string) |
| </signature> |
| </code></font> |
| </td></tr></table> |
| </p> |
| <dl> |
| <dt><strong>Parameters</strong></dt> |
| <dd> |
| <dl> |
| <dt>string</dt> |
| <dd> |
| <parameter name="string"> |
| the string to escape values, may be null. |
| </parameter> |
| </dd> |
| |
| |
| </dl> |
| </dd> |
| </dl> |
| <dl> |
| <dt><strong>Returns</strong></dt> |
| <dd> |
| <returns> |
| a new escaped <code>String</code>, <code>null</code> if null string input |
| </returns> |
| </dd> |
| </dl> |
| |
| <p>Delegates the process to |
| <a href="http://jakarta.apache.org/commons/lang/api/org/apache/commons/lang/StringEscapeUtils.html#escapeXml(java.lang.String)">StringEscapeUtils#escapeXml(String)</a>. |
| </p> |
| <p>If <code>$xml</code> had the following value:</p> |
| <table width="100%" cellpadding="1" cellspacing="0" border="0"><tr><td bgcolor="#000000"> |
| <table width="100%" cellpadding="5" cellspacing="0" border="0"><tr><td bgcolor="#FFFFFF"> |
| <pre><sourcecode>"bread" & "butter"</sourcecode></pre> |
| </td></tr></table> |
| </td></tr></table> |
| <p>then the following Velocity script:</p> |
| <table width="100%" cellpadding="1" cellspacing="0" border="0"><tr><td bgcolor="#000000"> |
| <table width="100%" cellpadding="5" cellspacing="0" border="0"><tr><td bgcolor="#FFFFFF"> |
| <pre><sourcecode>$esc.xml($xml)</sourcecode></pre> |
| </td></tr></table> |
| </td></tr></table> |
| <p>produces this output:</p> |
| <table width="100%" cellpadding="1" cellspacing="0" border="0"><tr><td bgcolor="#000000"> |
| <table width="100%" cellpadding="5" cellspacing="0" border="0"><tr><td bgcolor="#FFFFFF"> |
| <pre><sourcecode>&quot;bread&quot; &amp; &quot;butter&quot;</sourcecode></pre> |
| </td></tr></table> |
| </td></tr></table> |
| |
| |
| <br clear="all"> |
| |
| </td> |
| </tr> |
| </table> |
| <table border="0" cellspacing="0" cellpadding="2" width="100%"> |
| <tr> |
| <td colspan="2" bgcolor="#525D76"> |
| <font color="#ffffff" face="arial,helvetica.sanserif"> |
| <a name="sql()"> |
| <strong>sql()</strong></a></font> |
| </td> |
| </tr> |
| <tr> |
| <td NOWRAP> </td> |
| <td> |
| |
| <p> |
| <abstract> |
| Escapes the characters in a <code>String</code> to be suitable to pass to an SQL query. |
| </abstract> |
| </p> |
| <p> |
| <table width="100%"><tr><td bgcolor="EEEEEE"> |
| <font size="+1"><code> |
| <signature> |
| String sql(Object string) |
| </signature> |
| </code></font> |
| </td></tr></table> |
| </p> |
| <dl> |
| <dt><strong>Parameters</strong></dt> |
| <dd> |
| <dl> |
| <dt>string</dt> |
| <dd> |
| <parameter name="string"> |
| the string to escape values, may be null. |
| </parameter> |
| </dd> |
| |
| |
| </dl> |
| </dd> |
| </dl> |
| <dl> |
| <dt><strong>Returns</strong></dt> |
| <dd> |
| <returns> |
| a new String, escaped for SQL, <code>null</code> if null string input |
| </returns> |
| </dd> |
| </dl> |
| |
| <p>Delegates the process to |
| <a href="http://jakarta.apache.org/commons/lang/api/org/apache/commons/lang/StringEscapeUtils.html#escapeSql(java.lang.String)">StringEscapeUtils#escapeSql(String)</a>. |
| </p> |
| <p>If <code>$sql</code> had the following value:</p> |
| <table width="100%" cellpadding="1" cellspacing="0" border="0"><tr><td bgcolor="#000000"> |
| <table width="100%" cellpadding="5" cellspacing="0" border="0"><tr><td bgcolor="#FFFFFF"> |
| <pre><sourcecode>McHale's Navy</sourcecode></pre> |
| </td></tr></table> |
| </td></tr></table> |
| <p>then the following Velocity script:</p> |
| <table width="100%" cellpadding="1" cellspacing="0" border="0"><tr><td bgcolor="#000000"> |
| <table width="100%" cellpadding="5" cellspacing="0" border="0"><tr><td bgcolor="#FFFFFF"> |
| <pre><sourcecode>$esc.sql($sql)</sourcecode></pre> |
| </td></tr></table> |
| </td></tr></table> |
| <p>produces this output:</p> |
| <table width="100%" cellpadding="1" cellspacing="0" border="0"><tr><td bgcolor="#000000"> |
| <table width="100%" cellpadding="5" cellspacing="0" border="0"><tr><td bgcolor="#FFFFFF"> |
| <pre><sourcecode>McHale''s Navy</sourcecode></pre> |
| </td></tr></table> |
| </td></tr></table> |
| |
| |
| <br clear="all"> |
| |
| </td> |
| </tr> |
| </table> |
| <table border="0" cellspacing="0" cellpadding="2" width="100%"> |
| <tr> |
| <td colspan="2" bgcolor="#525D76"> |
| <font color="#ffffff" face="arial,helvetica.sanserif"> |
| <a name="getDollar()"> |
| <strong>getDollar()</strong></a></font> |
| </td> |
| </tr> |
| <tr> |
| <td NOWRAP> </td> |
| <td> |
| |
| <p> |
| <abstract> |
| Renders a dollar sign ($). |
| </abstract> |
| </p> |
| <p> |
| <table width="100%"><tr><td bgcolor="EEEEEE"> |
| <font size="+1"><code> |
| <signature> |
| String getDollar() |
| </signature> |
| </code></font> |
| </td></tr></table> |
| </p> |
| <dl> |
| <dt><strong>Returns</strong></dt> |
| <dd> |
| <returns> |
| a dollar sign ($). |
| </returns> |
| </dd> |
| </dl> |
| |
| <p>The following Velocity script:</p> |
| <table width="100%" cellpadding="1" cellspacing="0" border="0"><tr><td bgcolor="#000000"> |
| <table width="100%" cellpadding="5" cellspacing="0" border="0"><tr><td bgcolor="#FFFFFF"> |
| <pre><sourcecode>${esc.dollar}</sourcecode></pre> |
| </td></tr></table> |
| </td></tr></table> |
| <p>produces this output:</p> |
| <table width="100%" cellpadding="1" cellspacing="0" border="0"><tr><td bgcolor="#000000"> |
| <table width="100%" cellpadding="5" cellspacing="0" border="0"><tr><td bgcolor="#FFFFFF"> |
| <pre><sourcecode>$</sourcecode></pre> |
| </td></tr></table> |
| </td></tr></table> |
| |
| |
| <br clear="all"> |
| |
| </td> |
| </tr> |
| </table> |
| <table border="0" cellspacing="0" cellpadding="2" width="100%"> |
| <tr> |
| <td colspan="2" bgcolor="#525D76"> |
| <font color="#ffffff" face="arial,helvetica.sanserif"> |
| <a name="getD()"> |
| <strong>getD()</strong></a></font> |
| </td> |
| </tr> |
| <tr> |
| <td NOWRAP> </td> |
| <td> |
| |
| <p> |
| <abstract> |
| Renders a dollar sign ($). |
| </abstract> |
| </p> |
| <p> |
| <table width="100%"><tr><td bgcolor="EEEEEE"> |
| <font size="+1"><code> |
| <signature> |
| String getD() |
| </signature> |
| </code></font> |
| </td></tr></table> |
| </p> |
| <dl> |
| <dt><strong>Returns</strong></dt> |
| <dd> |
| <returns> |
| a dollar sign ($). |
| </returns> |
| </dd> |
| </dl> |
| |
| <p>The following Velocity script:</p> |
| <table width="100%" cellpadding="1" cellspacing="0" border="0"><tr><td bgcolor="#000000"> |
| <table width="100%" cellpadding="5" cellspacing="0" border="0"><tr><td bgcolor="#FFFFFF"> |
| <pre><sourcecode>${esc.d}</sourcecode></pre> |
| </td></tr></table> |
| </td></tr></table> |
| <p>produces this output:</p> |
| <table width="100%" cellpadding="1" cellspacing="0" border="0"><tr><td bgcolor="#000000"> |
| <table width="100%" cellpadding="5" cellspacing="0" border="0"><tr><td bgcolor="#FFFFFF"> |
| <pre><sourcecode>$</sourcecode></pre> |
| </td></tr></table> |
| </td></tr></table> |
| |
| |
| <br clear="all"> |
| |
| </td> |
| </tr> |
| </table> |
| <table border="0" cellspacing="0" cellpadding="2" width="100%"> |
| <tr> |
| <td colspan="2" bgcolor="#525D76"> |
| <font color="#ffffff" face="arial,helvetica.sanserif"> |
| <a name="getHash()"> |
| <strong>getHash()</strong></a></font> |
| </td> |
| </tr> |
| <tr> |
| <td NOWRAP> </td> |
| <td> |
| |
| <p> |
| <abstract> |
| Renders a hash (#). |
| </abstract> |
| </p> |
| <p> |
| <table width="100%"><tr><td bgcolor="EEEEEE"> |
| <font size="+1"><code> |
| <signature> |
| String getHash() |
| </signature> |
| </code></font> |
| </td></tr></table> |
| </p> |
| <dl> |
| <dt><strong>Returns</strong></dt> |
| <dd> |
| <returns> |
| a hash (#). |
| </returns> |
| </dd> |
| </dl> |
| |
| <p>The following Velocity script:</p> |
| <table width="100%" cellpadding="1" cellspacing="0" border="0"><tr><td bgcolor="#000000"> |
| <table width="100%" cellpadding="5" cellspacing="0" border="0"><tr><td bgcolor="#FFFFFF"> |
| <pre><sourcecode>${esc.hash}</sourcecode></pre> |
| </td></tr></table> |
| </td></tr></table> |
| <p>produces this output:</p> |
| <table width="100%" cellpadding="1" cellspacing="0" border="0"><tr><td bgcolor="#000000"> |
| <table width="100%" cellpadding="5" cellspacing="0" border="0"><tr><td bgcolor="#FFFFFF"> |
| <pre><sourcecode>#</sourcecode></pre> |
| </td></tr></table> |
| </td></tr></table> |
| |
| |
| <br clear="all"> |
| |
| </td> |
| </tr> |
| </table> |
| <table border="0" cellspacing="0" cellpadding="2" width="100%"> |
| <tr> |
| <td colspan="2" bgcolor="#525D76"> |
| <font color="#ffffff" face="arial,helvetica.sanserif"> |
| <a name="getH()"> |
| <strong>getH()</strong></a></font> |
| </td> |
| </tr> |
| <tr> |
| <td NOWRAP> </td> |
| <td> |
| |
| <p> |
| <abstract> |
| Renders a hash (#). |
| </abstract> |
| </p> |
| <p> |
| <table width="100%"><tr><td bgcolor="EEEEEE"> |
| <font size="+1"><code> |
| <signature> |
| String getH() |
| </signature> |
| </code></font> |
| </td></tr></table> |
| </p> |
| <dl> |
| <dt><strong>Returns</strong></dt> |
| <dd> |
| <returns> |
| a hash (#). |
| </returns> |
| </dd> |
| </dl> |
| |
| <p>The following Velocity script:</p> |
| <table width="100%" cellpadding="1" cellspacing="0" border="0"><tr><td bgcolor="#000000"> |
| <table width="100%" cellpadding="5" cellspacing="0" border="0"><tr><td bgcolor="#FFFFFF"> |
| <pre><sourcecode>${esc.h}</sourcecode></pre> |
| </td></tr></table> |
| </td></tr></table> |
| <p>produces this output:</p> |
| <table width="100%" cellpadding="1" cellspacing="0" border="0"><tr><td bgcolor="#000000"> |
| <table width="100%" cellpadding="5" cellspacing="0" border="0"><tr><td bgcolor="#FFFFFF"> |
| <pre><sourcecode>#</sourcecode></pre> |
| </td></tr></table> |
| </td></tr></table> |
| |
| |
| <br clear="all"> |
| |
| </td> |
| </tr> |
| </table> |
| <table border="0" cellspacing="0" cellpadding="2" width="100%"> |
| <tr> |
| <td colspan="2" bgcolor="#525D76"> |
| <font color="#ffffff" face="arial,helvetica.sanserif"> |
| <a name="getBackslash()"> |
| <strong>getBackslash()</strong></a></font> |
| </td> |
| </tr> |
| <tr> |
| <td NOWRAP> </td> |
| <td> |
| |
| <p> |
| <abstract> |
| Renders a backslash (\). |
| </abstract> |
| </p> |
| <p> |
| <table width="100%"><tr><td bgcolor="EEEEEE"> |
| <font size="+1"><code> |
| <signature> |
| String getBackslash() |
| </signature> |
| </code></font> |
| </td></tr></table> |
| </p> |
| <dl> |
| <dt><strong>Returns</strong></dt> |
| <dd> |
| <returns> |
| a backslash (\). |
| </returns> |
| </dd> |
| </dl> |
| |
| <p>The following Velocity script:</p> |
| <table width="100%" cellpadding="1" cellspacing="0" border="0"><tr><td bgcolor="#000000"> |
| <table width="100%" cellpadding="5" cellspacing="0" border="0"><tr><td bgcolor="#FFFFFF"> |
| <pre><sourcecode>${esc.backslash}</sourcecode></pre> |
| </td></tr></table> |
| </td></tr></table> |
| <p>produces this output:</p> |
| <table width="100%" cellpadding="1" cellspacing="0" border="0"><tr><td bgcolor="#000000"> |
| <table width="100%" cellpadding="5" cellspacing="0" border="0"><tr><td bgcolor="#FFFFFF"> |
| <pre><sourcecode>\</sourcecode></pre> |
| </td></tr></table> |
| </td></tr></table> |
| |
| |
| <br clear="all"> |
| |
| </td> |
| </tr> |
| </table> |
| <table border="0" cellspacing="0" cellpadding="2" width="100%"> |
| <tr> |
| <td colspan="2" bgcolor="#525D76"> |
| <font color="#ffffff" face="arial,helvetica.sanserif"> |
| <a name="getB()"> |
| <strong>getB()</strong></a></font> |
| </td> |
| </tr> |
| <tr> |
| <td NOWRAP> </td> |
| <td> |
| |
| <p> |
| <abstract> |
| Renders a backslash (\). |
| </abstract> |
| </p> |
| <p> |
| <table width="100%"><tr><td bgcolor="EEEEEE"> |
| <font size="+1"><code> |
| <signature> |
| String getB() |
| </signature> |
| </code></font> |
| </td></tr></table> |
| </p> |
| <dl> |
| <dt><strong>Returns</strong></dt> |
| <dd> |
| <returns> |
| a backslash (\). |
| </returns> |
| </dd> |
| </dl> |
| |
| <p>The following Velocity script:</p> |
| <table width="100%" cellpadding="1" cellspacing="0" border="0"><tr><td bgcolor="#000000"> |
| <table width="100%" cellpadding="5" cellspacing="0" border="0"><tr><td bgcolor="#FFFFFF"> |
| <pre><sourcecode>${esc.b}</sourcecode></pre> |
| </td></tr></table> |
| </td></tr></table> |
| <p>produces this output:</p> |
| <table width="100%" cellpadding="1" cellspacing="0" border="0"><tr><td bgcolor="#000000"> |
| <table width="100%" cellpadding="5" cellspacing="0" border="0"><tr><td bgcolor="#FFFFFF"> |
| <pre><sourcecode>\</sourcecode></pre> |
| </td></tr></table> |
| </td></tr></table> |
| |
| |
| <br clear="all"> |
| |
| </td> |
| </tr> |
| </table> |
| <table border="0" cellspacing="0" cellpadding="2" width="100%"> |
| <tr> |
| <td colspan="2" bgcolor="#525D76"> |
| <font color="#ffffff" face="arial,helvetica.sanserif"> |
| <a name="getQuote()"> |
| <strong>getQuote()</strong></a></font> |
| </td> |
| </tr> |
| <tr> |
| <td NOWRAP> </td> |
| <td> |
| |
| <p> |
| <abstract> |
| Renders a double quotation mark ("). |
| </abstract> |
| </p> |
| <p> |
| <table width="100%"><tr><td bgcolor="EEEEEE"> |
| <font size="+1"><code> |
| <signature> |
| String getQuote() |
| </signature> |
| </code></font> |
| </td></tr></table> |
| </p> |
| <dl> |
| <dt><strong>Returns</strong></dt> |
| <dd> |
| <returns> |
| a double quotation mark ("). |
| </returns> |
| </dd> |
| </dl> |
| |
| <p>The following Velocity script:</p> |
| <table width="100%" cellpadding="1" cellspacing="0" border="0"><tr><td bgcolor="#000000"> |
| <table width="100%" cellpadding="5" cellspacing="0" border="0"><tr><td bgcolor="#FFFFFF"> |
| <pre><sourcecode>${esc.quote}</sourcecode></pre> |
| </td></tr></table> |
| </td></tr></table> |
| <p>produces this output:</p> |
| <table width="100%" cellpadding="1" cellspacing="0" border="0"><tr><td bgcolor="#000000"> |
| <table width="100%" cellpadding="5" cellspacing="0" border="0"><tr><td bgcolor="#FFFFFF"> |
| <pre><sourcecode>"</sourcecode></pre> |
| </td></tr></table> |
| </td></tr></table> |
| |
| |
| <br clear="all"> |
| |
| </td> |
| </tr> |
| </table> |
| <table border="0" cellspacing="0" cellpadding="2" width="100%"> |
| <tr> |
| <td colspan="2" bgcolor="#525D76"> |
| <font color="#ffffff" face="arial,helvetica.sanserif"> |
| <a name="getQ()"> |
| <strong>getQ()</strong></a></font> |
| </td> |
| </tr> |
| <tr> |
| <td NOWRAP> </td> |
| <td> |
| |
| <p> |
| <abstract> |
| Renders a double quotation mark ("). |
| </abstract> |
| </p> |
| <p> |
| <table width="100%"><tr><td bgcolor="EEEEEE"> |
| <font size="+1"><code> |
| <signature> |
| String getQ() |
| </signature> |
| </code></font> |
| </td></tr></table> |
| </p> |
| <dl> |
| <dt><strong>Returns</strong></dt> |
| <dd> |
| <returns> |
| a double quotation mark ("). |
| </returns> |
| </dd> |
| </dl> |
| |
| <p>The following Velocity script:</p> |
| <table width="100%" cellpadding="1" cellspacing="0" border="0"><tr><td bgcolor="#000000"> |
| <table width="100%" cellpadding="5" cellspacing="0" border="0"><tr><td bgcolor="#FFFFFF"> |
| <pre><sourcecode>${esc.q}</sourcecode></pre> |
| </td></tr></table> |
| </td></tr></table> |
| <p>produces this output:</p> |
| <table width="100%" cellpadding="1" cellspacing="0" border="0"><tr><td bgcolor="#000000"> |
| <table width="100%" cellpadding="5" cellspacing="0" border="0"><tr><td bgcolor="#FFFFFF"> |
| <pre><sourcecode>"</sourcecode></pre> |
| </td></tr></table> |
| </td></tr></table> |
| |
| |
| <br clear="all"> |
| |
| </td> |
| </tr> |
| </table> |
| <table border="0" cellspacing="0" cellpadding="2" width="100%"> |
| <tr> |
| <td colspan="2" bgcolor="#525D76"> |
| <font color="#ffffff" face="arial,helvetica.sanserif"> |
| <a name="getSingleQuote()"> |
| <strong>getSingleQuote()</strong></a></font> |
| </td> |
| </tr> |
| <tr> |
| <td NOWRAP> </td> |
| <td> |
| |
| <p> |
| <abstract> |
| Renders a single quotation mark ('). |
| </abstract> |
| </p> |
| <p> |
| <table width="100%"><tr><td bgcolor="EEEEEE"> |
| <font size="+1"><code> |
| <signature> |
| String getSingleQuote() |
| </signature> |
| </code></font> |
| </td></tr></table> |
| </p> |
| <dl> |
| <dt><strong>Returns</strong></dt> |
| <dd> |
| <returns> |
| a single quotation mark ('). |
| </returns> |
| </dd> |
| </dl> |
| |
| <p>The following Velocity script:</p> |
| <table width="100%" cellpadding="1" cellspacing="0" border="0"><tr><td bgcolor="#000000"> |
| <table width="100%" cellpadding="5" cellspacing="0" border="0"><tr><td bgcolor="#FFFFFF"> |
| <pre><sourcecode>${esc.singleQuote}</sourcecode></pre> |
| </td></tr></table> |
| </td></tr></table> |
| <p>produces this output:</p> |
| <table width="100%" cellpadding="1" cellspacing="0" border="0"><tr><td bgcolor="#000000"> |
| <table width="100%" cellpadding="5" cellspacing="0" border="0"><tr><td bgcolor="#FFFFFF"> |
| <pre><sourcecode>'</sourcecode></pre> |
| </td></tr></table> |
| </td></tr></table> |
| |
| |
| <br clear="all"> |
| |
| </td> |
| </tr> |
| </table> |
| <table border="0" cellspacing="0" cellpadding="2" width="100%"> |
| <tr> |
| <td colspan="2" bgcolor="#525D76"> |
| <font color="#ffffff" face="arial,helvetica.sanserif"> |
| <a name="getS()"> |
| <strong>getS()</strong></a></font> |
| </td> |
| </tr> |
| <tr> |
| <td NOWRAP> </td> |
| <td> |
| |
| <p> |
| <abstract> |
| Renders a single quotation mark ('). |
| </abstract> |
| </p> |
| <p> |
| <table width="100%"><tr><td bgcolor="EEEEEE"> |
| <font size="+1"><code> |
| <signature> |
| String getS() |
| </signature> |
| </code></font> |
| </td></tr></table> |
| </p> |
| <dl> |
| <dt><strong>Returns</strong></dt> |
| <dd> |
| <returns> |
| a single quotation mark ('). |
| </returns> |
| </dd> |
| </dl> |
| |
| <p>The following Velocity script:</p> |
| <table width="100%" cellpadding="1" cellspacing="0" border="0"><tr><td bgcolor="#000000"> |
| <table width="100%" cellpadding="5" cellspacing="0" border="0"><tr><td bgcolor="#FFFFFF"> |
| <pre><sourcecode>${esc.s}</sourcecode></pre> |
| </td></tr></table> |
| </td></tr></table> |
| <p>produces this output:</p> |
| <table width="100%" cellpadding="1" cellspacing="0" border="0"><tr><td bgcolor="#000000"> |
| <table width="100%" cellpadding="5" cellspacing="0" border="0"><tr><td bgcolor="#FFFFFF"> |
| <pre><sourcecode>'</sourcecode></pre> |
| </td></tr></table> |
| </td></tr></table> |
| |
| |
| <br clear="all"> |
| |
| </td> |
| </tr> |
| </table> |
| <table border="0" cellspacing="0" cellpadding="2" width="100%"> |
| <tr> |
| <td colspan="2" bgcolor="#525D76"> |
| <font color="#ffffff" face="arial,helvetica.sanserif"> |
| <a name="getExclamation()"> |
| <strong>getExclamation()</strong></a></font> |
| </td> |
| </tr> |
| <tr> |
| <td NOWRAP> </td> |
| <td> |
| |
| <p> |
| <abstract> |
| Renders an exclamation mark (!). |
| </abstract> |
| </p> |
| <p> |
| <table width="100%"><tr><td bgcolor="EEEEEE"> |
| <font size="+1"><code> |
| <signature> |
| String getExclamation() |
| </signature> |
| </code></font> |
| </td></tr></table> |
| </p> |
| <dl> |
| <dt><strong>Returns</strong></dt> |
| <dd> |
| <returns> |
| an exclamation mark (!). |
| </returns> |
| </dd> |
| </dl> |
| |
| <p>The following Velocity script:</p> |
| <table width="100%" cellpadding="1" cellspacing="0" border="0"><tr><td bgcolor="#000000"> |
| <table width="100%" cellpadding="5" cellspacing="0" border="0"><tr><td bgcolor="#FFFFFF"> |
| <pre><sourcecode>${esc.exclamation}</sourcecode></pre> |
| </td></tr></table> |
| </td></tr></table> |
| <p>produces this output:</p> |
| <table width="100%" cellpadding="1" cellspacing="0" border="0"><tr><td bgcolor="#000000"> |
| <table width="100%" cellpadding="5" cellspacing="0" border="0"><tr><td bgcolor="#FFFFFF"> |
| <pre><sourcecode>!</sourcecode></pre> |
| </td></tr></table> |
| </td></tr></table> |
| |
| |
| <br clear="all"> |
| |
| </td> |
| </tr> |
| </table> |
| <table border="0" cellspacing="0" cellpadding="2" width="100%"> |
| <tr> |
| <td colspan="2" bgcolor="#525D76"> |
| <font color="#ffffff" face="arial,helvetica.sanserif"> |
| <a name="getE()"> |
| <strong>getE()</strong></a></font> |
| </td> |
| </tr> |
| <tr> |
| <td NOWRAP> </td> |
| <td> |
| |
| <p> |
| <abstract> |
| Renders an exclamation mark (!). |
| </abstract> |
| </p> |
| <p> |
| <table width="100%"><tr><td bgcolor="EEEEEE"> |
| <font size="+1"><code> |
| <signature> |
| String getE() |
| </signature> |
| </code></font> |
| </td></tr></table> |
| </p> |
| <dl> |
| <dt><strong>Returns</strong></dt> |
| <dd> |
| <returns> |
| an exclamation mark (!). |
| </returns> |
| </dd> |
| </dl> |
| |
| <p>The following Velocity script:</p> |
| <table width="100%" cellpadding="1" cellspacing="0" border="0"><tr><td bgcolor="#000000"> |
| <table width="100%" cellpadding="5" cellspacing="0" border="0"><tr><td bgcolor="#FFFFFF"> |
| <pre><sourcecode>${esc.e}</sourcecode></pre> |
| </td></tr></table> |
| </td></tr></table> |
| <p>produces this output:</p> |
| <table width="100%" cellpadding="1" cellspacing="0" border="0"><tr><td bgcolor="#000000"> |
| <table width="100%" cellpadding="5" cellspacing="0" border="0"><tr><td bgcolor="#FFFFFF"> |
| <pre><sourcecode>!</sourcecode></pre> |
| </td></tr></table> |
| </td></tr></table> |
| |
| |
| <br clear="all"> |
| |
| </td> |
| </tr> |
| </table> |
| |
| </td> |
| |
| </tr> |
| |
| <!-- FOOTER SEPARATOR --> |
| <tr> |
| <td colspan="2"> |
| <hr noshade="" size="1"/> |
| </td> |
| </tr> |
| |
| <!-- PAGE FOOTER --> |
| <tr><td colspan="2"> |
| <div align="center"><font color="#525D76" size="-1"><em> |
| Copyright © 1999-2003, Apache Software Foundation |
| </em></font></div> |
| </td></tr> |
| |
| </table> |
| </body> |
| </html> |