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
-
5.1 The .NET Framework: Big Picture Figure 5‑1 The .NET Framework in Context Looking at Figure 5‑1 we see the lifespan of managed c...
-
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...
-
What Is Visual Basic and Why do I need it? Visual Basic is Easy to learn Programming language. With Visual Basic you can develop Windows bas...
-
4.4 The .NET Framework SDK Documentation When you install Visual Studio .NET or the .NET Framework SDK you should make a point of in...
-
A program is usually not limited to a linear sequence of instructions. During its process it may bifurcate, repeat code or take decisions. F...
-
Data Adapter Configuration Wizard Generating DataSet To create a DataSet, select Data->Generate DataSet from the main menu. From the dial...
-
SQL Management Studio comes in two flavours: 1. SQL Management Studio This edition comes with all versions of SQL Server 2005 except SQL Ser...
-
4.2 The Framework Class Library Now that you have a taste of the goals and groundwork laid by the CLR and managed code, let’s taste ...
-
The SQL AVG aggregate function selects the average value for certain table column. Have a look at the SQL AVG syntax: SELECT AVG(Column1) FR...
-
4.3 Using the FCL “Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime.” The IO strea...
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!