|
Programmers Guide > Encoding Text and URLs
Encoding Text and URLs
The JotServletTemplateBean method
getHTMLText() replaces '<', '>', '&' and single and double
quotes with the equivalent HTML character entities. The replacement values
are decimal strings like <. In this example the dynamic value
attribute is encoded with JOT.HTMLText so that embedded HTML will
not interfere with the page layout:
<input type="checkbox" name="FooX" value="JOT.HTMLText(JOT.FooX)">
The JotServletPropertyBean method
getURLEncode() encodes a string into an
application/x-www-form-urlencoded MIME format. Space is converted
to a '+' and other special characters are converted to %xy where xy
is the hex value of the character. This is useful for encoding query
parameters in hyperlinks (hrefs). This JOT Template example also
illustrates the use of
getWebappURL(path):
<a href="JOT.WebappURL(/FooPath)?FooArg=JOT.URLEncode(JOT.FooArg)">
|