Name

Variable Directive

Synopsis

This directive can be used only in tag files. It declares variables exposed by the tag file to the page where the corresponding custom action is used.

Syntax

<%@ variable name-given="attrAndVarName" | 
  name-from-attribute="attrName" alias="varName"
  [declare="true|false"] [description="description"]
  [scope="AT_BEGIN|AT_END|NESTED"] [variable-class="varType"]
%>

Attributes

Attribute Name

Default

Description

alias

No default

The name of the local page scope variable the tag file uses to hold the value it creates. The container copies the value of the local variable to the variable in the invoking page’s page scope named by the attribute specified by the name-from-attribute attribute.

declare
true

Set to false if no scripting variable declaration should be created in the page implementation class.

description

No default

A description of the variable that can be displayed by a page-authoring tool.

name-from-attribute

No default

The name of the attribute that specifies the variable to hold the value created by the tag file. This attribute must be used in combination with the alias attribute, and must not be used with the name-given attribute.

name-given

No default

The name of the variable in the invoking page’s page scope the tag file uses to expose the value it creates. This attribute must not be used with the name-from-attribute attribute.

scope
NESTED

The visibility of the variable, one of AT_BEGIN, AT_END, or NESTED.

variable-class ...

Get JavaServer Pages, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.