jQuery in Action, 3rd edition
The moose likes JSP and the fly likes calling web site Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "calling web site" Watch "calling web site" New topic

calling web site

Paul Richards

Joined: Jul 25, 2001
Posts: 19
Here is my problem. I need to determine which web site called ours.
For example if the user did a search in yahoo.com and this provided a link to our website, how could I determine that the previous site was www.yahoo.com?
I need to do this for marketing reasons!!! They want to know who is coming to our site via which search engine.
cheers Paul
Brian Glodde
Ranch Hand

Joined: Jun 27, 2001
Posts: 171
Have a look at the "HTTP_REFERER" field in the HTTP headers via getHeader(String name) in the request object.
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
HTTPRequest headers has the Referer header that you can check.

So much trouble in the world -- Bob Marley
Paul Richards

Joined: Jul 25, 2001
Posts: 19
thanks for the replies
I have tried using your suggestion and using the following code
<%String url = new String();
url = request.getHeader("Referer");
I actually got this d122
as the url
This is not what I was quite expecting, have I done something wrong?
thanks in advance Paul
I agree. Here's the link: http://aspose.com/file-tools
subject: calling web site
It's not a secret anymore!