Declarations in JSP

How are Declarations used in JSP?


JSP Declarations are used to declare instance variables, methods of JSP page implementation class.



Example :

<%! int j=5; %>
<h5>The Incrmeneted Value of J<h5>
<%= j=j+1 %>
Result :

The Incrmeneted Value of J

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.

Ask Questions

Ask Question