.


Divya

JSP Declaration Tag


To declare variable or method in JSP declaration tag is used.

Syntax

<%! Scripting-language-declaration %>

Example

In this example we are declaring the field and printing the value of the declared field using the jsp expression tag.

Example

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

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

</body>
</html>


.