Advertisement
Guest User

Java Program

a guest
Sep 1st, 2014
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. Write a jsp code that display counter value where counter variable is defined with different scope
  2.  
  3. <HTML>
  4. <HEAD>
  5. <TITLE>JSP page Counter</TITLE>
  6. </HEAD>
  7.  
  8. <BODY>
  9. <H1>JSP page Counter</H1>
  10. <%Integer applicationCount = (Integer)application.getAttribute("applicationCount");
  11.  
  12. if (applicationCount == null)
  13. {
  14. applicationCount = new Integer(1);
  15. }
  16. else
  17. {
  18. applicationCount= new Integer(applicationCount.intValue() + 1);
  19. }
  20. application.setAttribute("applicationCount", applicationCount);
  21. %>
  22.  
  23.  
  24. <BR>
  25. Visitors to this page so far <%=applicationCount%> (visitor).
  26. </BODY>
  27. </HTML>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement