wood burning stoves 2.0*
The moose likes Servlets and the fly likes How do I get docroot from the servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "How do I get docroot from the servlet " Watch "How do I get docroot from the servlet " New topic
Author

How do I get docroot from the servlet

Siva kandasamy
Ranch Hand

Joined: Dec 31, 2002
Posts: 139
Hi there,
How do I get server's docroot from the servlet ?

What is the industry standard or the best way to locate, physical location of XSL & XML file's from the servlet as we can not hard code the absolute path of XSL & XML file in the servlet ?

thanks
siva

[ October 24, 2004: Message edited by: Siva kandasamy ]

[ October 24, 2004: Message edited by: Siva kandasamy ]
[ October 24, 2004: Message edited by: Siva kandasamy ]
ernest fakudze
Ranch Hand

Joined: Aug 27, 2001
Posts: 216
This might be useful. I tested it in a JSP though

<code>
<%
String runningPath = application.getRealPath(request.getServletPath());
String serverName = request.getServerName();
out.println( runningPath );
out.println( serverName );
%>
</code>


In a time of drastic change it is the learners who inherit the future. The learned usually find themselves equipped to live in a world that no longer exists.<br />Eric Hoffer
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How do I get docroot from the servlet