
Creating your second JSP page
For the second example, we will make use of the different
tags we have learnt. This example will declare two variables;
one string used to stored the name of a website and an integer
called counter that displays the number of times the page has
been accessed. There is also a private method declared to
increment the counter. The website name and counter value are
displayed.
<HTML>
<HEAD>
<TITLE> JSP Example 2</TITLE>
</HEAD>
<BODY> JSP Example 2
<BR>
<%!
String sitename = “builder.com”;
int counter = 0;
private void increment Counter()
{
counter ++;
}
%>
Website of the day is
<%= sitename %>
<BR>
page accessed
<%= counter %>
</BODY>
</HTML>
|