public class EscapeBodyTag extends HtmlEscapingAwareTag implements BodyTag
<escapeBody>
tag is used to escape its enclosed body content,
applying HTML escaping and/or JavaScript escaping.
Provides a "htmlEscape" property for explicitly specifying whether to apply HTML escaping. If not set, a page-level default (e.g. from the HtmlEscapeTag) or an application-wide default (the "defaultHtmlEscape" context-param in web.xml) is used.
Provides a "javaScriptEscape" property for specifying whether to apply JavaScript escaping. Can be combined with HTML escaping or used standalone.
Attribute | Required? | Runtime Expression? | Description |
---|---|---|---|
htmlEscape | false | true | Set HTML escaping for this tag, as boolean value. Overrides the default HTML escaping setting for the current page. |
javaScriptEscape | false | true | Set JavaScript escaping for this tag, as boolean value. Default is false. |
HtmlUtils
,
JavaScriptUtils
,
Serialized Formlogger, REQUEST_CONTEXT_PAGE_ATTRIBUTE
id, pageContext
EVAL_BODY_BUFFERED, EVAL_BODY_TAG
EVAL_BODY_AGAIN
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
Constructor and Description |
---|
EscapeBodyTag() |
Modifier and Type | Method and Description |
---|---|
int |
doAfterBody() |
void |
doInitBody() |
protected int |
doStartTagInternal()
Called by doStartTag to perform the actual work.
|
protected java.lang.String |
readBodyContent()
Read the unescaped body content from the page.
|
void |
setBodyContent(BodyContent bodyContent) |
void |
setJavaScriptEscape(boolean javaScriptEscape)
Set JavaScript escaping for this tag, as boolean value.
|
protected void |
writeBodyContent(java.lang.String content)
Write the escaped body content to the page.
|
htmlEscape, isDefaultHtmlEscape, isHtmlEscape, isResponseEncodedHtmlEscape, setHtmlEscape
doCatch, doFinally, doStartTag, getRequestContext
doEndTag, findAncestorWithClass, getId, getParent, getValue, getValues, release, removeValue, setId, setPageContext, setParent, setValue
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
doEndTag, doStartTag, getParent, release, setPageContext, setParent
public void setJavaScriptEscape(boolean javaScriptEscape) throws JspException
JspException
protected int doStartTagInternal()
RequestContextAwareTag
doStartTagInternal
in class RequestContextAwareTag
TagSupport.doStartTag()
public void doInitBody()
doInitBody
in interface BodyTag
public void setBodyContent(BodyContent bodyContent)
setBodyContent
in interface BodyTag
public int doAfterBody() throws JspException
doAfterBody
in interface IterationTag
doAfterBody
in class TagSupport
JspException
protected java.lang.String readBodyContent() throws java.io.IOException
java.io.IOException
- if reading failedprotected void writeBodyContent(java.lang.String content) throws java.io.IOException
Can be overridden in subclasses, e.g. for testing purposes.
content
- the content to writejava.io.IOException
- if writing failed