• Post Reply Bookmark Topic Watch Topic
  • New Topic

How do I get my current URL???  RSS feed

 
Nasser Aboobaker
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Can some one tell me how to grab the current URL in a JSP page. I mean the page is forwarded from a servlet and it is showing the servlet url. I want to check whether the page is loaded directly or loaded by a forward.
Thanks in advance.
Nasser
 
Bosun Bello
Ranch Hand
Posts: 1512
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is a requestheader called "Referer". You can check for this, if it's not null, the page was forwarded to you. It indicates the URL of the refering page. Check the servlet API for more details.
 
Nasser Aboobaker
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Bosun,
I couldnt find refer in API and I couldnt find it in the book which I have. Will look again today.
Thanks.
Nasser
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!