A JSP declaration is used to declare variables and methods in a page’s scripting language.
The syntax for a declaration is as follows:
<%! scripting-language-declaration %>
Example for declaring Variable:
index.jsp
Example for declaring method :
index.jsp
The syntax for a declaration is as follows:
<%! scripting-language-declaration %>
Example for declaring Variable:
index.jsp
<html>
<body>
<%! int a=5; %>
<%= "Value of Integer a is "+ (++a) %>
</body>
</html>
Example for declaring method :
index.jsp
<HTML>
<BODY>
<%!
void getName()
{
System.out.println( "LoveJavaBytes" );
}
%>
Name is : <%= getName() %>
</BODY>
</HTML>
No comments:
Post a Comment