tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shapira, Yoav" <Yoav.Shap...@mpi.com>
Subject RE: Please help with Tomcat - newbie
Date Tue, 18 Jun 2002 20:03:27 GMT
Howdy ;)
By definition (see servlet spec), you can't read anything under WEB-INF.

If you could, the right approach would be like  
String path = getServletContext().getRealPath("/WEB-INF/classes")
File directory = new File(path);
...

Yoav Shapira
Millennium ChemInformatics


>-----Original Message-----
>From: Simon Wong [mailto:summerrain@btinternet.com]
>Sent: Tuesday, June 18, 2002 2:58 PM
>To: tomcat-user@jakarta.apache.org
>Subject: RE: Please help with Tomcat - newbie
>
>Hello,
>
>I am trying to get the servlet to obtain a list of filenames and
>directories in my servlet class to be sent back to the applet. However,
I
>am not sure if my approach is correct.
>I used the following code in my servlet class in the directory:
C:\(where i
>installed my tomcat)\Apache Tomcat 4.0\webapps\ROOT\WEB-
>INF\classes\MyServlet.class
>Codes in the class:
>File directory = new File("classes");
>File [] filenames = directory.listFile();
>>> The result i get is null. No directory name "classes".
>However, when I tried using "." (I presume it means current directory),
it
>seems to be in windows/system32 ??
>I am quite confused about this. How do I actually refer to the
directory I
>mentioned above? Do I need to configure anything? I really need help!
Your
>advise will be much appreciated. Thanks
>
>Best Regards,
>Simon

--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message