public class VariableInfo extends Object
Scripting variables generated by a custom action have an associated scope of either AT_BEGIN, NESTED, or AT_END.
The class name (VariableInfo.getClassName) in the returned objects is used to
determine the types of the scripting variables. Note that because scripting
variables are assigned their values from scoped attributes which cannot be of
primitive types, "boxed" types such as
java.lang.Integer must be used instead of primitives.
The class name may be a Fully Qualified Class Name, or a short class name.
If a Fully Qualified Class Name is provided, it should refer to a class that should be in the CLASSPATH for the Web Application (see Servlet 2.4 specification - essentially it is WEB-INF/lib and WEB-INF/classes). Failure to be so will lead to a translation-time error.
If a short class name is given in the VariableInfo objects, then the class name must be that of a public class in the context of the import directives of the page where the custom action appears. The class must also be in the CLASSPATH for the Web Application (see Servlet 2.4 specification - essentially it is WEB-INF/lib and WEB-INF/classes). Failure to be so will lead to a translation-time error.
Frequently a fully qualified class name will refer to a class that is known to the tag library and thus, delivered in the same JAR file as the tag handlers. In most other remaining cases it will refer to a class that is in the platform on which the JSP processor is built (like J2EE). Using fully qualified class names in this manner makes the usage relatively resistant to configuration errors.
A short name is usually generated by the tag library based on some attributes passed through from the custom action user (the author), and it is thus less robust: for instance a missing import directive in the referring JSP page will lead to an invalid short name class and a translation error.
The result of the invocation on getVariableInfo is an array of VariableInfo objects. Each such object describes a scripting variable by providing its name, its type, whether the variable is new or not, and what its scope is. Scope is best described through a picture:
The JSP 2.0 specification defines the interpretation of 3 values:
1 Called after
Variable Synchronization Points Variable Synchronization Points
doStartTag() doInitBody() doAfterBody() doEndTag() doTag() Tag
EVAL_BODY_INCLUDEis returned, or after
Variable Information in the TLD
Scripting variable information can also be encoded directly for most cases into the Tag Library Descriptor using the <variable> subelement of the <tag> element. See the JSP specification.
|Modifier and Type
|Field and Description
Scope information that scripting variable is visible after start tag.
Scope information that scripting variable is visible after end tag.
Scope information that scripting variable is visible only within the start/end tags.
|Constructor and Description
Constructor These objects can be created (at translation time) by the TagExtraInfo instances.
|Modifier and Type
|Method and Description
Returns the type of this variable.
Returns whether this is a new variable.
Returns the lexical scope of the variable.
Returns the name of the scripting variable.
public static final int NESTED
public static final int AT_BEGIN
public static final int AT_END
varName - The name of the scripting variable
className - The type of this variable
declare - If true, it is a new variable (in some languages this will
require a declaration)
scope - Indication on the lexical scope of the variable
public String getVarName()
public String getClassName()
public boolean getDeclare()
Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.