Jul 20, 2008

Jsp Pages Visited

Free Web Hosting, No Ads > CONTRIBUTE > Computers > Programming Languages > Java, Java Servlets, Java Script, & JSP

free web hosting

Jsp Pages Visited

kvarnerexpress
Hi all,

I want to keep track of how often certain pages are visited but I don't want to have it such that someone can keep refreshing a page to increment the number of times a page is visited.

What would be the best way to keep track of visiters on my site so I can know what pages they are going to.

I'm going to database this data so I can generate a little "most visited" list for my page of, say, the top 5 most visited pages.

I imagine using a cookie or something but I would like to have a time frame on it, such that, if the same person re-visits the site after, x amount of time (an hour/day), the page 'hit' will increment.


Reply

Tyssen
You should Google 'session variables'.

Reply

cse-icons
hi kvarnerexpress,

yeah you can use session in this case.

When someone visits the page, use the session id to identify which session is requesting the page and put it in a hashmap with the count. and/or time. Now when the page is requested again. check whether it is from the same session, if it is, then compare the time of last visit and update the count if sufficient time has elapsed else just serve the page.

You need to run a cleanup routine at regular intervals so that the sessions in the hashmap that have not been used for a long time are removed so as to free up the space..

Cheers.

Reply

vitrus
I started a class that should mesure hits, visits, etc per day (in a servlet) today...

I will post the result soon!

Reply

dul

Use session variables. But good idea is save the session variable in a database. (such as IP address etc..). After that you can control you counter as much as you want.

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Similar Topics

Keywords : jsp pages visited

  1. A Cookie Question. - How would I make one-time warning pages? (1)



Looking for jsp, pages, visited

Searching Video's for jsp, pages, visited
advertisement



Jsp Pages Visited



 

 

 

 

ADD REPLY / Got an Opinion! Remove these ADs! RAPID SEARCH! Free Web Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE