Hello Devs,


In this tutorial, we are going to learn about JSP Declaration Tag. To declare variable or method in JSP declaration tag is used.


Syntax

<%! Scripting-language-declaration %>

Example

<!DOCTYPE html>
<html>
<head>
<title>Declaration tag</title>
</head>
<body>

<%! int a=100; %>
<%= "Value of the variable is:"+a %>

</body>
</html>


I hope this example helps you.