Solved

Tomcat Servlet - Find directory of webapp

Posted on 2010-09-22
4
571 Views
Last Modified: 2013-11-24
In a servlet, I'd like to be able to find the web-inf directory of the webapps directory for web app the servlet is in dynamically.

How can I do this?
0
Comment
Question by:modsiw
  • 2
4 Comments
 
LVL 3

Author Comment

by:modsiw
ID: 33736936
Aka, on a windows box default install, I'd like to find:

C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\MyApp\
0
 
LVL 40

Accepted Solution

by:
gurvinder372 earned 250 total points
ID: 33737388
ServletContext.getRealPath("WEB-INF")

or

Servlet.getServletContext().getRealPath()

or

request.getRealPath(request.getServletPath())

0
 
LVL 92

Assisted Solution

by:objects
objects earned 250 total points
ID: 33739621
0
 
LVL 3

Author Closing Comment

by:modsiw
ID: 33873447
thanks
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

705 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now