Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Counting the number of visitors for a web page- JavaScript and Struts1

 
Dhananjaya Cn
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,

Im a new bee here.
My problem is, I need to keep track of number of vistors to a web page.
i hav planned lik this:
On load of the home page, i will call a javascript callCounter();
from javascript i need to call an action and update a record in database.

Please help me with this.
How do i call the action?
i should be in the same home jsp after updating database

I am using Struts 1 and Liferay portal.

Thanks in advance,
DJ
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know why you'd do it in JavaScript; seems like if it's application-wide it would be more appropriate to put it in a custom request processor.
 
Dhananjaya Cn
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am a new bee to struts. Please can you tell me how to accomplish this using RequestProcessor.

Thanks,
Dj
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For every request get the URL (minus parameters) and increment an associated counter in the DB.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65105
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Dhananjaya Cn", please check your private messages for an important administrative matter.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic