Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Need help on web page hit counter  RSS feed

 
JR AA
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am trying to work on hit counter for a website.For each page on site, i have to have a counter to know how many hits were there for each page.

1) Most of the code I am getting is for a single page, where in counter keeps incrementing for each access of that page. If I have multiple pages on website, how will I trace which page is accessed and depending on that how to increament the counter.
2)If any one has sample code for this, could you please let me know.

thanks
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch!
You'll find this forum a great place to seek help on JSP pages, and there aren't many rules you'll have to worry about, but one is that proper names are required. Please take a look at the JavaRanch Naming Policy and change your display name to match it.
In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.
Thanks!
For your question...basically you need a way to track the page. The only thing that is different is the page url so you need to make that the key to your counter. Have a database and increment where ever you see the url.
Eric
 
steve souza
Ranch Hand
Posts: 862
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are interested in tracking hits and performance then check out JAMon. There is a servlet filter that tracks all hits for all JSP's, servlets, gif's, html, jpg's,... It is not the type of counter that lets your web site users know how many hits your page has had though. For that I would do a google. There is a ton of those out there.
To see the JAMon report (that has page hit counters) go to http://www.ssouza.com/fdsapi/JAMonAdmin.jsp. To see the servlet filter type http://www.ssouza.com/fdsapi/JAMonFilter.java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!