• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to get WebApplication name, not the DisplayName

 
eric mcentee
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, quick question... I've searched the forum and can't seem to find an answer.
I'm not sure if this is possible, but can you get the actual WebApplication name from a JSP using taglib's?
I know I can get a ServletContext from a PageContext, and then use getServletContextName(), but this returns the display name, and I need to get to the actual WebApp name.
The only other thing I can think is to use getRealPath(String pathName) off of ServletContext and parse the string that comes back. I don't want to do this because 1)It's nasty, 2) I don't want to have to construct a fake virtual path just to pass into this.
Thanks for the help....
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65122
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if by "WebApplication name" you mean the app context, you can get it off the request with getContextPath() (and strip off the slash if you prefer).
hth,
bear
 
eric mcentee
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmmmm..
So if I have the following directory structure..

I will be able to get to "MyWebApp" using that method?
Thanks for the reply, this is a dumb question, but its really got me confused.
[ September 05, 2003: Message edited by: eric mcentee ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65122
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, unless you explicitly mapped the context to another name. You could also just try it out and see if it gets you what you want.
hth,
bear
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic