[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Java Code to display web root path

Posted on 2004-11-09
9
Medium Priority
?
237 Views
Last Modified: 2008-03-17
Does anybody know code that will tell you the webroot.   We are using jboss 3.2.5 on Windows 2000 server to deploy our app.
0
Comment
Question by:gdlp2004
  • 8
9 Comments
 
LVL 13

Expert Comment

by:petmagdy
ID: 12535022
0
 
LVL 13

Expert Comment

by:petmagdy
ID: 12535105
did u try getRealPath() on JBOSS?
0
 
LVL 13

Accepted Solution

by:
petmagdy earned 2000 total points
ID: 12535164
try this and see if it will not return null hopefully:

getServletContext().getRealPath("/");
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 13

Expert Comment

by:petmagdy
ID: 12535203
for sorry it seems that it returns null :(

read this link
http://www.jspwiki.org/Wiki.jsp?page=FixedBugs&version=10

my advice stick to the properties file
0
 
LVL 13

Expert Comment

by:petmagdy
ID: 12535224
please note that if JBOSS dosn't explod the WAR then there is no Web root
0
 
LVL 13

Expert Comment

by:petmagdy
ID: 12535515
if this help the following returns the Web application temprary directory try it on JBOSS and see the return directory:

        Object path =  getServletConfig().getServletContext().getAttribute("javax.servlet.context.tempdir");
        System.out.println(" <p> Path: " + path.toString()+ "</p>");
0
 

Author Comment

by:gdlp2004
ID: 12537812
PetMagdy if I could give you 1000 points I would!!!  That tip just saved our lives!
0
 
LVL 13

Expert Comment

by:petmagdy
ID: 12537830
welcome :)
0
 
LVL 13

Expert Comment

by:petmagdy
ID: 12537834
but which tip was useful to u?
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Suggested Courses
Course of the Month20 days, 4 hours left to enroll

872 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