Syntax of JSP Declaratives are:
<%!
//java codes
%>
JSP Declaratives begins with <%! and ends %> with .We can embed any amount of java code in the JSP Declaratives. Variables and functions defined in the declaratives are class level and can be used anywhere in the JSP page.
<%@page contentType="text/html" %>
<html>
<body>
<%!
int cnt=0;
private int getCount(){
//increment cnt and return the value
cnt++;
return cnt;
}
%>
<p>Values of Cnt are:</p>
<p><%=getCount()%></p>
<p><%=getCount()%></p>
<p><%=getCount()%></p>
<p><%=getCount()%></p>
<p><%=getCount()%></p>
<p><%=getCount()%></p>
</body>
</html>
Popular Posts
-
SQL aliases can be used with database tables and with database table columns, depending on task you are performing. SQL column aliases are u...
-
1 Introducing the .NET Framework with C# The .NET Framework is such a comprehensive platform that it can be a little difficult to descr...
-
Declaration of variables In order to use a variable in C++, we must first declare it specifying which data type we want it to be. The syntax...
-
A "service" is an application that can start automatically when the computer starts. There are two start up modes: 1. Automatic - ...
-
STRINGS: The way a group of integers can be stored in an integer array, similarly a group of characters can be stored in a character array. ...
-
Arguments passed by value and by reference. Until now, in all the functions we have seen, the arguments passed to the functions have been pa...
-
Inheritance A key feature of OOP is reusability. It's always time saving and useful if we can reuse something that already exists rather...
-
Introduction: In this exercise, you are going to build and run a sample Java program called Homework using NetBeans. The sample program can...
-
The SQL ORDER BY clause comes in handy when you want to sort your SQL result sets by some column(s). For example if you want to select all t...
-
MSDE stands for Microsoft Desktop Engine. MSDE is replaced with Microsoft SQL Server 2005 Express. MSDE is a free, light weight version of S...
I am extremely impressed along with your writing abilities, Thanks for this great share.
ReplyDeleteNice Post. I simply stumbled upon your blog and wanted to say that I have really enjoyed
ReplyDeletebrowsing your weblog posts. After all I'll be subscribing on your feed and I am hoping you to
write again very soon!