org.springframework.web.servlet.tags
Class EscapeBodyTag
java.lang.Object
javax.servlet.jsp.tagext.TagSupport
org.springframework.web.servlet.tags.RequestContextAwareTag
org.springframework.web.servlet.tags.HtmlEscapingAwareTag
org.springframework.web.servlet.tags.EscapeBodyTag
- All Implemented Interfaces:
- Serializable, BodyTag, IterationTag, JspTag, Tag, TryCatchFinally
public class EscapeBodyTag
- extends HtmlEscapingAwareTag
- implements BodyTag
Custom JSP tag 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.
- Since:
- 1.1.1
- Author:
- Juergen Hoeller
- See Also:
HtmlUtils
,
JavaScriptUtils
,
Serialized Form
Methods inherited from class javax.servlet.jsp.tagext.TagSupport |
doEndTag, findAncestorWithClass, getId, getParent, getValue, getValues, release, removeValue, setId, setPageContext, setParent, setValue |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
EscapeBodyTag
public EscapeBodyTag()
setJavaScriptEscape
public void setJavaScriptEscape(String javaScriptEscape)
throws JspException
- Set JavaScript escaping for this tag, as boolean value.
Default is "false".
- Throws:
JspException
doStartTagInternal
protected int doStartTagInternal()
- Description copied from class:
RequestContextAwareTag
- Called by doStartTag to perform the actual work.
- Specified by:
doStartTagInternal
in class RequestContextAwareTag
- Returns:
- same as TagSupport.doStartTag
- See Also:
TagSupport.doStartTag()
doInitBody
public void doInitBody()
- Specified by:
doInitBody
in interface BodyTag
setBodyContent
public void setBodyContent(BodyContent bodyContent)
- Specified by:
setBodyContent
in interface BodyTag
doAfterBody
public int doAfterBody()
throws JspException
- Specified by:
doAfterBody
in interface IterationTag
- Overrides:
doAfterBody
in class TagSupport
- Throws:
JspException
readBodyContent
protected String readBodyContent()
throws IOException
- Read the unescaped body content from the page.
- Returns:
- the original content
- Throws:
IOException
- if reading failed
writeBodyContent
protected void writeBodyContent(String content)
throws IOException
- Write the escaped body content to the page.
Can be overridden in subclasses, e.g. for testing purposes.
- Parameters:
content
- the content to write
- Throws:
IOException
- if writing failed
Copyright (c) 2002-2005 The Spring Framework Project.