Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to get the browser url

 
anwar pasha
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


how to get browser url in java code

ex:

http://serverip:port/contents
 
James Ward
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since it is in browser, wouldn't you want to use javascript?

In JavaScript:
location.href will give you this.


 
Zandis Murāns
Ranch Hand
Posts: 174
Java Java ME Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The javax.servlet.http.HttpServletRequest interface has several methods you can use for the various parts of the URL, including getRequestURI, getQueryString, getScheme, getServerName and getServerPort.
 
Tim Holloway
Saloon Keeper
Posts: 18303
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Browsers don't have URLs. Servers do.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic