org.springframework.web.servlet.tags
Class TransformTag

java.lang.Object
  extended by TagSupport
      extended by org.springframework.web.servlet.tags.RequestContextAwareTag
          extended by org.springframework.web.servlet.tags.HtmlEscapingAwareTag
              extended by org.springframework.web.servlet.tags.TransformTag

public class TransformTag
extends HtmlEscapingAwareTag

Tag for transforming reference data values from form 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, useable in HTML forms. This tag uses that PropertyEditor to transform objects passed into this tag.

Since:
20.09.2003
Author:
Alef Arendsen, Juergen Hoeller
See Also:
BindTag

Field Summary
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
 
Fields inherited from class org.springframework.web.servlet.tags.RequestContextAwareTag
logger, REQUEST_CONTEXT_PAGE_ATTRIBUTE
 
Constructor Summary
TransformTag()
           
 
Method Summary
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.
 
Methods inherited from class org.springframework.web.servlet.tags.HtmlEscapingAwareTag
isDefaultHtmlEscape, isHtmlEscape, setHtmlEscape
 
Methods inherited from class org.springframework.web.servlet.tags.RequestContextAwareTag
doCatch, doFinally, doStartTag, getRequestContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

value

private java.lang.Object value
the value to transform using the appropriate property editor


var

private java.lang.String var
the variable to put the result in


scope

private java.lang.String scope
the scope of the variable the result will be put in

Constructor Detail

TransformTag

public TransformTag()
Method Detail

setValue

public void setValue(java.lang.Object value)
Set the value to transform, using the appropriate PropertyEditor from the enclosing BindTag.

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).

Like all of Spring's JSP tags, this tag is capable of parsing EL expressions itself, on any JSP version. Note, however, that EL expressions in a JSP 2.0 page will be evaluated by the JSP container, with the result getting passed in here. For this reason, the type of this property is Object (accepting any result object from a pre-evaluated expression) rather than String.


setVar

public void setVar(java.lang.String var)
Set PageContext attribute name under which to expose a variable that contains the result of the transformation.

See Also:
setScope(java.lang.String), javax.servlet.jsp.PageContext#setAttribute

setScope

public void setScope(java.lang.String scope)
Set the scope to export the variable to. Default is SCOPE_PAGE ("page").

See Also:
setVar(java.lang.String), TagUtils.SCOPE_PAGE, javax.servlet.jsp.PageContext#setAttribute

doStartTagInternal

protected final int doStartTagInternal()
                                throws JspException
Description copied from class: RequestContextAwareTag
Called by doStartTag to perform the actual work.

Specified by:
doStartTagInternal in class RequestContextAwareTag
Returns:
same as TagSupport.doStartTag
Throws:
JspException
See Also:
javax.servlet.jsp.tagext.TagSupport#doStartTag