tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Larry Meadors" <>
Subject RE: Quick Question
Date Wed, 14 Aug 2002 15:11:25 GMT
IMO, it seems like a bad idea to me to tie your bean 
code to a servlet context unless you REALLY need to.

To me, a better way would be to put the file in a 
directory under classes, and use the classloader of 
the current thread to get to the file.

This way, you do not need servlet.jar to use your bean 
if you every decide to use it outside of a servlet.

This is a very simple process. Here is an example:

private InputStream getFile(String name){
 return Thread.

To read a properties file classes/ 
for instance, you just do this:

Properties p = new Properties();


>>> 08/14/02 08:42 AM >>>
It will work in a bean if you pass a reference 
to the servlet context to it...

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message