File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Trap a url Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Trap a url" Watch "Trap a url" New topic

Trap a url

Sanjay pts
Ranch Hand

Joined: Nov 07, 2000
Posts: 357
I want to find out how i can trap a url from which the user has come to my web-site.
Suppose there is some advertisement on the net on which if he clicks he will be directed to my web-site. now that ad may be on many web-sites, so how do i trap from which web-site he has clicked the ad and come to my web-site
Sanjay Patel

Eat JAVA, Drink JAVA, Sleep Java
Preethi M

Joined: Oct 24, 2000
Posts: 22
Hi Sanjay!
I have a solution from which site the user actually clicked the ad.
public class test extends HttpServlet
public void service(HttpServletRequest req,HttpServletResponse res) throws ServletException,IOException
PrintWriter out=res.getWriter();
String referer=req.getHeader("Referer");//the referer value will be ur required URL.
Hope this will help u.
Preethi M
I agree. Here's the link:
subject: Trap a url
It's not a secret anymore!