Solved

Tomcat Servlet - Find directory of webapp

Posted on 2010-09-22
4
574 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
JList custom Cell Renderer refresh 15 57
servlet example 11 40
web application structure 18 77
jboss wildfly 10.1 10 96
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…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

810 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