JSP Expression Language


<!-- JSP EL -->

<%@ page import = "java.io.*,java.util.*" %>

<html>
   <head>
      <title>Application object in JSP</title>
   </head>
  
   <body>
   <center><h2>
      <%
         Integer count = (Integer)application.getAttribute("hitCounter");
         if( count ==null || count == 0 )
           {
            out.println("Welcome to my website!");
            count = 1;
         }
           else
           { 
            out.println("Welcome back to my website!");
            count += 1;
         }
         application.setAttribute("hitCounter", count);
      %>
      <br/><br/>
         <p>Total number of visits: <%= count%></p>
      </h2></center>
  
   </body>
</html>

No comments:

Post a Comment

Don't be a silent reader...
Leave your comments...

Anu