aspose file tools*
The moose likes JSP and the fly likes Get Full URL from Header? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Get Full URL from Header?" Watch "Get Full URL from Header?" New topic
Author

Get Full URL from Header?

Drew Lane
Ranch Hand

Joined: May 13, 2001
Posts: 296
How do I get the full url (as shown in the address bar) into my JSP page?
I can use 'request.getRequestURI()'
but that only show part of the URL.
What if I want the full thing with http:// and ? parameters, etc.
Thanks,
Drew
Peter Kristensson
Ranch Hand

Joined: Jul 02, 2001
Posts: 118
use the request.getRequestURL() instead (includes http://...../a.jsp or whatever)
it returns a StringBuffer.
Use request.getQueryString() to get the "a=101&b=202" parameter string.
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
request.getRequestURL() is available with the latest servlet/JSP API. If you are using an older version, you still have to use getRequestURI and just get the host out of the request.


Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
 
Don't get me started about those stupid light bulbs.
 
subject: Get Full URL from Header?