JSP Declaration Tag
- Declaration tag is used to declare one or more variables or methods at class level.
- Variables and methods declare in declaration tag are initialized at the time of JSP initialization.
- These variables and methods are kept outside of the service method by web container to make them class level.
|<%! Variable or method Declaration %>|
<title>Declaration tag example</title>
int sum(int a, int b)
return a + b;
out.println(“Sum of 10 and 20 = ” + sum(10, 20));