Java Server Page

JSP Projects

JSP Project

adplus-dvertising
Write a program that display Increment in counter
Previous Home Next
Save that program as a helloR4R.jsp

This In this program the counter should be increment by refresh the page as no of time refresh the page, count should be increment.

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="java.io.*;" %>
<!program for display  the " NO. of time a website visit">
<!save as a helloR4R.jsp >
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>R4R Tech Soft</title>
    </head>
    <body>
        <!h1,h2.....is used for display heading >
    <h1>Hello R4R Tech Soft!Web site vist</h1>

    <!Declaration tag is used to declare the object/Code>
    <%!    String sitename = "www.r4r.co.in";
           static int count = 0;
            private void increamentcount()  {
          count++;
          }
    %>
    <!method is call>
    <% increamentcount(); %>
    Website visit of the day
    <!Expression Tag is used Expresses the code>
    <%= sitename%><BR><BR>
    No. of time Website visit: <%= count %>
</body>
</html>
Output:
No. of time refresh the page, increment in its counter
Previous Home Next