Class EvalTag
java.lang.Object
jakarta.servlet.jsp.tagext.TagSupport
org.springframework.web.servlet.tags.RequestContextAwareTag
org.springframework.web.servlet.tags.HtmlEscapingAwareTag
org.springframework.web.servlet.tags.EvalTag
- All Implemented Interfaces:
IterationTag
,JspTag
,Tag
,TryCatchFinally
,Serializable
The
<eval>
tag evaluates a Spring expression (SpEL) and either prints
the result or assigns it to a variable. Supports the standard JSP evaluation
context consisting of implicit variables and scoped attributes.
Attribute | Required? | Runtime Expression? | Description |
---|---|---|---|
expression | true | true | The expression to evaluate. |
htmlEscape | false | true | Set HTML escaping for this tag, as a boolean value. Overrides the default HTML escaping setting for the current page. |
javaScriptEscape | false | true | Set JavaScript escaping for this tag, as a boolean value.
Default is false . |
scope | false | true | The scope for the var. 'application', 'session', 'request' and 'page' scopes are supported. Defaults to page scope. This attribute has no effect unless the var attribute is also defined. |
var | false | true | The name of the variable to export the evaluation result to. If not specified the evaluation result is converted to a String and written as output. |
- Since:
- 3.0.1
- Author:
- Keith Donald, Juergen Hoeller, Sam Brannen
- See Also:
-
Field Summary
Fields inherited from class org.springframework.web.servlet.tags.RequestContextAwareTag
logger, REQUEST_CONTEXT_PAGE_ATTRIBUTE
Fields inherited from class jakarta.servlet.jsp.tagext.TagSupport
id, pageContext
Fields inherited from interface jakarta.servlet.jsp.tagext.IterationTag
EVAL_BODY_AGAIN
Fields inherited from interface jakarta.servlet.jsp.tagext.Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
doEndTag()
int
Called by doStartTag to perform the actual work.void
setExpression
(String expression) Set the expression to evaluate.void
setJavaScriptEscape
(boolean javaScriptEscape) Set JavaScript escaping for this tag, as boolean value.void
Set the scope to export the evaluation result to.void
Set the variable name to expose the evaluation result under.Methods inherited from class org.springframework.web.servlet.tags.HtmlEscapingAwareTag
htmlEscape, isDefaultHtmlEscape, isHtmlEscape, isResponseEncodedHtmlEscape, setHtmlEscape
Methods inherited from class org.springframework.web.servlet.tags.RequestContextAwareTag
doCatch, doFinally, doStartTag, getRequestContext
Methods inherited from class jakarta.servlet.jsp.tagext.TagSupport
doAfterBody, findAncestorWithClass, getId, getParent, getValue, getValues, release, removeValue, setId, setPageContext, setParent, setValue
-
Constructor Details
-
EvalTag
public EvalTag()
-
-
Method Details
-
setExpression
Set the expression to evaluate. -
setVar
Set the variable name to expose the evaluation result under. Defaults to rendering the result to the current JspWriter. -
setScope
Set the scope to export the evaluation result to. This attribute has no meaning unless var is also defined. -
setJavaScriptEscape
Set JavaScript escaping for this tag, as boolean value. Default is "false".- Throws:
JspException
-
doStartTagInternal
Description copied from class:RequestContextAwareTag
Called by doStartTag to perform the actual work.- Specified by:
doStartTagInternal
in classRequestContextAwareTag
- Returns:
- same as TagSupport.doStartTag
- Throws:
JspException
- See Also:
-
doEndTag
- Specified by:
doEndTag
in interfaceTag
- Overrides:
doEndTag
in classTagSupport
- Throws:
JspException
-