public class TransformTag extends HtmlEscapingAwareTag
<transform>
tag provides transformation for reference data values
from controllers and other objects inside a spring:bind
tag (or a
data-bound form element tag from Spring's form tag library).
The BindTag has a PropertyEditor that it uses to transform properties of a bean to a String, usable in HTML forms. This tag uses that PropertyEditor to transform objects passed into this tag.
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. |
scope | false | true | The scope to use when exported the result to a variable. This attribute is only used when var is also set. Possible values are page, request, session and application. |
value | true | true | The value to transform. This is the actual object you want to have transformed (for instance a Date). Using the PropertyEditor that is currently in use by the 'spring:bind' tag. |
var | false | true | The string to use when binding the result to the page, request, session or application scope. If not specified, the result gets outputted to the writer (i.e. typically directly to the JSP). |
BindTag
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
scope
the scope of the variable the result will be put in
|
private java.lang.Object |
value
the value to transform using the appropriate property editor
|
private java.lang.String |
var
the variable to put the result in
|
logger, REQUEST_CONTEXT_PAGE_ATTRIBUTE
Constructor and Description |
---|
TransformTag() |
Modifier and Type | Method and Description |
---|---|
protected int |
doStartTagInternal()
Called by doStartTag to perform the actual work.
|
void |
setScope(java.lang.String scope)
Set the scope to export the variable to.
|
void |
setValue(java.lang.Object value)
Set the value to transform, using the appropriate PropertyEditor
from the enclosing BindTag.
|
void |
setVar(java.lang.String var)
Set PageContext attribute name under which to expose
a variable that contains the result of the transformation.
|
htmlEscape, isDefaultHtmlEscape, isHtmlEscape, isResponseEncodedHtmlEscape, setHtmlEscape
doCatch, doFinally, doStartTag, getRequestContext
@Nullable private java.lang.Object value
@Nullable private java.lang.String var
private java.lang.String scope
public void setValue(java.lang.Object value)
The value can either be a plain value to transform (a hard-coded String value in a JSP or a JSP expression), or a JSP EL expression to be evaluated (transforming the result of the expression).
public void setVar(java.lang.String var)
setScope(java.lang.String)
,
javax.servlet.jsp.PageContext#setAttribute
public void setScope(java.lang.String scope)
setVar(java.lang.String)
,
TagUtils.SCOPE_PAGE
,
javax.servlet.jsp.PageContext#setAttribute
protected final int doStartTagInternal() throws JspException
RequestContextAwareTag
doStartTagInternal
in class RequestContextAwareTag
JspException
javax.servlet.jsp.tagext.TagSupport#doStartTag