Forums Register Login

How do you get the url?

+Pie Number of slices to send: Send
I am trying to get the full url of the page that I am on to do some dynamic menu generation and I can't seem to figure out how to do this. Is there a simple command?
Thanks in advance,
Matt
+Pie Number of slices to send: Send

not sure I get what you want....
do you want to create a new URL obj? OR
do you want to get the full URL from a
request obj of a Servlet/JSP?
could you pl clarify?
regds.
- satya
+Pie Number of slices to send: Send
I want to get the full url from the jsp. For example if I were on this page I would want to be able to get:
http://www.javaranch.com/ubb/Forum7/HTML/005895.html
Thanks,
Matt
+Pie Number of slices to send: Send
Well, I guess I figured it out.
<%= request.getRequestURI() %>
Thanks for the help though.
+Pie Number of slices to send: Send

ummm...you could use that method.
However, you might want to read thru this documentation.
Seems that there will be a difference in get and post requests.
Not sure if this is what you are looking for?
Alternatively, you could use:
request.getHeader("Referer");
regds.
- satya
Police line, do not cross. Well, this tiny ad can go through:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 660 times.
Similar Threads
Get a URL from a Webpage
JavaRanch site navigation
Get Servlet URL
database url
How to get a String from an InputStream
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 19:41:09.