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
-
1.1 Code in a Highly Distributed World Software that addresses the Internet must be able to communicate. However, the Internet is n...
-
SQL is short for Structured Query Language and is a widely used database language, providing means of data manipulation (store, retrieve, up...
-
As you learned in one of the previous chapters, SQL Management Studio can be used to manage multiple instances of SQL Server . However, when...
-
As mentioned on the .NET Framework page, .NET Framework is designed for cross-language compatibility. Cross-language compatibility means .NE...
-
The SQL AND clause is used when you want to specify more than one condition in your SQL WHERE clause, and at the same time you want all con...
-
5.3 Draw.aspx Web Applications I am just about to finish this tutorial. I have given you a couple of code samples to chew on, but t...
-
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. ...
-
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...
-
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...
-
Simple Binding Data Binding Data Binding is binding controls to data from the database. With data binding we can bind a control to a partic...
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!