Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get previous URL?

Tags:

java

jsf

I need the URL from which my web app is called. For eg:- If there is a link to my site foo.com from stackoverflow.com, I need the stackoverflow link in web app(managed bean).

All helps appreciated, thanks.

like image 981
Johny T Koshy Avatar asked Aug 09 '11 10:08

Johny T Koshy


1 Answers

Not always filled, but you can use:

HttpServletRequest.getHeader("Referer");

Note: The spelling error is on purpose. For an explanation see here.

like image 103
nfechner Avatar answered Sep 22 '22 01:09

nfechner