org.springframework.web.servlet.tags
Class HtmlEscapingAwareTag

java.lang.Object
  extended by TagSupport
      extended by org.springframework.web.servlet.tags.RequestContextAwareTag
          extended by org.springframework.web.servlet.tags.HtmlEscapingAwareTag
Direct Known Subclasses:
AbstractFormTag, BindErrorsTag, BindTag, EscapeBodyTag, EvalTag, MessageTag, TransformTag, UrlTag

public abstract class HtmlEscapingAwareTag
extends RequestContextAwareTag

Superclass for tags that output content that might get HTML-escaped.

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.

Since:
1.1
Author:
Juergen Hoeller
See Also:
setHtmlEscape(java.lang.String), HtmlEscapeTag, RequestContext.isDefaultHtmlEscape(), WebUtils.isDefaultHtmlEscape(ServletContext)

Field Summary
private  java.lang.Boolean htmlEscape
           
 
Fields inherited from class org.springframework.web.servlet.tags.RequestContextAwareTag
logger, REQUEST_CONTEXT_PAGE_ATTRIBUTE
 
Constructor Summary
HtmlEscapingAwareTag()
           
 
Method Summary
protected  boolean isDefaultHtmlEscape()
          Return the applicable default HTML escape setting for this tag.
protected  boolean isHtmlEscape()
          Return the HTML escaping setting for this tag, or the default setting if not overridden.
 void setHtmlEscape(java.lang.String htmlEscape)
          Set HTML escaping for this tag, as boolean value.
 
Methods inherited from class org.springframework.web.servlet.tags.RequestContextAwareTag
doCatch, doFinally, doStartTag, doStartTagInternal, getRequestContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

htmlEscape

private java.lang.Boolean htmlEscape
Constructor Detail

HtmlEscapingAwareTag

public HtmlEscapingAwareTag()
Method Detail

setHtmlEscape

public void setHtmlEscape(java.lang.String htmlEscape)
                   throws JspException
Set HTML escaping for this tag, as boolean value. Overrides the default HTML escaping setting for the current page.

Throws:
JspException
See Also:
HtmlEscapeTag.setDefaultHtmlEscape(java.lang.String)

isHtmlEscape

protected boolean isHtmlEscape()
Return the HTML escaping setting for this tag, or the default setting if not overridden.

See Also:
isDefaultHtmlEscape()

isDefaultHtmlEscape

protected boolean isDefaultHtmlEscape()
Return the applicable default HTML escape setting for this tag.

The default implementation checks the RequestContext's setting, falling back to false in case of no explicit default given.

See Also:
RequestContextAwareTag.getRequestContext()