This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes JSP and the fly likes how to get first part of URL ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » JSP
Bookmark "how to get first part of URL ?" Watch "how to get first part of URL ?" New topic
Author

how to get first part of URL ?

Nakata kokuyo
Ranch Hand

Joined: Apr 13, 2005
Posts: 457
hi, good day, if i would like to get the first part(don't know what it call) of URL http://myservername/app/index.jsp in jsp page

is there any method we can use ?

meaning i need to get the result with "myservername" , not other part ..any idea ? thank you for guidance
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 63211
    
  69

Have you explored the methods on HttpServletRequest?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Nakata kokuyo
Ranch Hand

Joined: Apr 13, 2005
Posts: 457
thanks, bear , i have try on getContextpath and getPathInfo() ....now only realize is actually request.getLocalName(); ...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to get first part of URL ?
 
It's not a secret anymore!