Use ServletContext.getResourceAsStream()

-Tim

gabor wrote:

hi,

i have to access some resource files from my servlet.
the problem is that i don't know the path to the files.

for example:
i know that the files in in servlet-directory/resources/table.xml,

but i don't know where is servlet-directory.
for now i solved this with adding a parameter to web.xml,
like:
    <init-param>
      <param-name>SERVLET_HOME</param-name>
        <param-value>
                /home/gabor/work/tomcat/webapps/myServlet
        </param-value>
    </init-param>

but i think this is quite ugly. what if i move the servlet to a
different place.?

the best would be something in the java-servlet api, which somehow could
give me the dir, where the servlet lives. but i couldn't find anything
like that.

how do you solve this problem?

thanks,
gabor


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to