virtual directory

Posted on 2005-03-24
Medium Priority
Last Modified: 2013-11-18

From a JSP page how do i get the path to the virtual directory. for example i am including a page from various files that are in various folders and i need to provide an absolute path.. eg


i.e. what do use to get my base applications path

Question by:makerp
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 10

Author Comment

ID: 13626367
i am using Tomcat
LVL 92

Accepted Solution

objects earned 500 total points
ID: 13626452
use the getRealPath() method of ServetContext (application)
LVL 10

Author Comment

ID: 13628863
ah - this is what i need request.getContextPath(), i need the virtual directory name, getRealPath() gets the disk path which is not what i want..

i will accpet your answer anyway as you lead me to the HttpServletRequest class which is where i found what i wanted


Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is an update and follow-up of my previous article:   Storage 101: common concepts in the IT enterprise storage This time, I expand on more frequently used storage concepts.
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
Suggested Courses

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question