Declares a variable or method valid in the page scripting language.
<%! int i = 0; %> <%! int a, b, c; %> <%! Circle a = new Circle(2.0); %>
A declaration declares one or more variables or methods for use later in the JSP source file.
A declaration must contain at least one complete declarative statement. You can declare any number of variables or methods within one declaration tag, as long as they are separated by semicolons. The declaration must be valid in the scripting language used in the JSP file. In JSP 1.0, you must use the JavaTM programming language for scripting, and declarations must conform to the Java Language Specification.
When you use the Java programming language for scripting, remember these rules:
In general, a declaration has page scope, so it is valid in scriptlets, expressions, and other declarations within the same JSP source file. But if a JSP file includes other files, the rules of scope become a bit trickier. The rules of scope for declarations are described below:
<jsp:include>, declarations have page scope.
<jsp:include>or the Include Directive, declarations have translation unit scope. A translation unit is the JSP source file plus all of its static include files, but without any dynamic include files.