Meaningless Drivel is fun!*
The moose likes Struts and the fly likes Counting the number of visitors for a web page- JavaScript and Struts1 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Counting the number of visitors for a web page- JavaScript and Struts1" Watch "Counting the number of visitors for a web page- JavaScript and Struts1" New topic
Author

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

Dhananjaya Cn
Greenhorn

Joined: Feb 18, 2010
Posts: 2
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

Joined: Sep 29, 2008
Posts: 12617

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

Joined: Feb 18, 2010
Posts: 2
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

Joined: Sep 29, 2008
Posts: 12617

For every request get the URL (minus parameters) and increment an associated counter in the DB.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60794
    
  65

"Dhananjaya Cn", please check your private messages for an important administrative matter.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
Consider Paul's rocket mass heater.
 
subject: Counting the number of visitors for a web page- JavaScript and Struts1
 
Similar Threads
I need to enter some value in JSP text field and then need to press enter which should fetch data
how to call one textfield to another textfield
Which server-side script takes the input from JavaScript in j2ee application
window.form
Close a pop-window after submit is complete?