Package com.aspectran.web.support.tags
Class EscapeBodyTag
- java.lang.Object
-
- javax.servlet.jsp.tagext.TagSupport
-
- com.aspectran.web.support.tags.CurrentActivityAwareTag
-
- com.aspectran.web.support.tags.HtmlEscapingAwareTag
-
- com.aspectran.web.support.tags.EscapeBodyTag
-
- All Implemented Interfaces:
java.io.Serializable,javax.servlet.jsp.tagext.BodyTag,javax.servlet.jsp.tagext.IterationTag,javax.servlet.jsp.tagext.JspTag,javax.servlet.jsp.tagext.Tag,javax.servlet.jsp.tagext.TryCatchFinally
public class EscapeBodyTag extends HtmlEscapingAwareTag implements javax.servlet.jsp.tagext.BodyTag
The<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 Summary 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. - See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class com.aspectran.web.support.tags.CurrentActivityAwareTag
logger
-
-
Constructor Summary
Constructors Constructor Description EscapeBodyTag()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intdoAfterBody()voiddoInitBody()protected intdoStartTagInternal()Called by doStartTag to perform the actual work.protected java.lang.StringreadBodyContent()Read the unescaped body content from the page.voidsetBodyContent(javax.servlet.jsp.tagext.BodyContent bodyContent)voidsetJavaScriptEscape(boolean javaScriptEscape)Set JavaScript escaping for this tag, as boolean value.protected voidwriteBodyContent(java.lang.String content)Write the escaped body content to the page.-
Methods inherited from class com.aspectran.web.support.tags.HtmlEscapingAwareTag
htmlEscape, isDefaultHtmlEscape, isHtmlEscape, setHtmlEscape
-
Methods inherited from class com.aspectran.web.support.tags.CurrentActivityAwareTag
doCatch, doFinally, doStartTag, getCurrentActivity
-
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
doEndTag, findAncestorWithClass, getId, getParent, getValue, getValues, release, removeValue, setId, setPageContext, setParent, setValue
-
-
-
-
Method Detail
-
setJavaScriptEscape
public void setJavaScriptEscape(boolean javaScriptEscape)
Set JavaScript escaping for this tag, as boolean value. Default is "false".
-
doStartTagInternal
protected int doStartTagInternal()
Description copied from class:CurrentActivityAwareTagCalled by doStartTag to perform the actual work.- Specified by:
doStartTagInternalin classCurrentActivityAwareTag- Returns:
- same as TagSupport.doStartTag
- See Also:
TagSupport.doStartTag()
-
doInitBody
public void doInitBody()
- Specified by:
doInitBodyin interfacejavax.servlet.jsp.tagext.BodyTag
-
setBodyContent
public void setBodyContent(@Nullable javax.servlet.jsp.tagext.BodyContent bodyContent)
- Specified by:
setBodyContentin interfacejavax.servlet.jsp.tagext.BodyTag
-
doAfterBody
public int doAfterBody() throws javax.servlet.jsp.JspException- Specified by:
doAfterBodyin interfacejavax.servlet.jsp.tagext.IterationTag- Overrides:
doAfterBodyin classjavax.servlet.jsp.tagext.TagSupport- Throws:
javax.servlet.jsp.JspException
-
readBodyContent
protected java.lang.String readBodyContent()
Read the unescaped body content from the page.- Returns:
- the original content
-
writeBodyContent
protected void writeBodyContent(java.lang.String content) throws java.io.IOExceptionWrite the escaped body content to the page.Can be overridden in subclasses, e.g. for testing purposes.
- Parameters:
content- the content to write- Throws:
java.io.IOException- if writing failed
-
-