The Java EE 5 Tutorial

Variable Synchronization

The web container handles the synchronization of variables between a tag file and a calling page. Table 8–5 summarizes when and how each object is synchronized according to the object’s scope.

Table 8–5 Variable Synchronization Behavior

Tag File Location 

AT_BEGIN

NESTED

AT_END

Beginning 

Not sync. 

Save 

Not sync. 

Before any fragment invocation using jsp:invoke or jsp:doBody (see Evaluating Fragments Passed to Tag Files)

Tag->page 

Tag->page 

Not sync. 

End 

Tag->page 

Restore 

Tag->page 

If name-given is used to specify the variable name, then the name of the variable in the calling page and the name of the variable in the tag file are the same and are equal to the value of name-given.

The name-from-attribute and alias attributes of the variable directive can be used to customize the name of the variable in the calling page while another name is used in the tag file. When using these attributes, you set the name of the variable in the calling page from the value of name-from-attribute at the time the tag was called. The name of the corresponding variable in the tag file is the value of alias.