| Codemiles.com Programming Forums http://www.codemiles.com/ |
|
| jsp page counter http://www.codemiles.com/jsp-examples/jsp-page-counter-t3315.html |
Page 1 of 1 |
| Author: | msi_333 [ Sun Jan 11, 2009 1:36 am ] |
| Post subject: | jsp page counter |
jsp page counter code Code: <HTML>
<HEAD> <TITLE>JSP page Counter</TITLE> </HEAD> <BODY> <H1>JSP page Counter</H1> <% Integer applicationCount = (Integer)application.getAttribute("applicationCount"); if (applicationCount == null) { applicationCount = new Integer(1); } else { applicationCount= new Integer(applicationCount.intValue() + 1); } application.setAttribute("applicationCount", applicationCount); %> <BR> Visitors to this page so far <%=applicationCount%> (visitor). </BODY> </HTML> |
|
| Author: | DummiesInJavaVer2 [ Wed Mar 25, 2009 4:17 am ] |
| Post subject: | Re: jsp page counter |
Thanks for providing jsp page counter. Btw, i have to ask you what <% means ? |
|
| Author: | trekie86 [ Fri Apr 24, 2009 8:23 pm ] |
| Post subject: | Re: jsp page counter |
The tag <% means that the following code is Java. The %> ends the java code and goes back to html. |
|
| Author: | 2dogs2 [ Sun Oct 04, 2009 10:13 am ] |
| Post subject: | Re: jsp page counter |
Just curious where does the counter store the number of hits ??? Thanks/ |
|
| Author: | msi_333 [ Sun Oct 04, 2009 11:11 am ] |
| Post subject: | Re: jsp page counter |
Using the application object we use the getAttribute and setAttribute to save variables .Here the variable named "applicationCount" . application object control attributes with the scope all over your JSP application . There are also other known objects like (session) object , which often used to save parameter while login process . |
|
| Page 1 of 1 | All times are UTC [ DST ] |
| Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |
|