Declarations in JSP
How are Declarations used in JSP?
Explanation
JSP Declarations are used to declare instance variables, methods of JSP page implementation class.
Syntax:
<%!...>
Example :
<%! int j=5; %>
<h5>The Incrmeneted Value of J<h5>
<%= j=j+1 %>
Result :
The Incrmeneted Value of J
6
In the above example we have used the JSP Declaration tag to declare the value of the integer "j". In the JSP Expression tag we use the expression "j=j+1" to display the output.