----- Original Message -----
From: "S Ramakrishnan" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>


> How do I obtain the root path of my web application from
> the ServletContext?

Look at the API docs for ServletContext.getRealPath(String s)
getRealPath("/") should return the path for the root  of the Context.


> I have a file that nedds to be
> accessed in init() and I'd like to obtain the
> absolute path of the file based on the root
> path of the application and the name of the file
> in <init-param>.

A better alternative for your requirements may be to take the FileName as a
<init-param> and use the methods

- ServletContext.getResource()
- ServletContext.getResourceAsStream()

Check the API docs/Servlet specs for details of these methods.

Regds,
Gokul

>
> Thanks,
>
> Rk
> x77309

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to