You could put together a constructor or method for your DAO that accepts
an input stream to read.  That would at least maintain it's independence
from the servlet container.  Just need to have whatever create's an
instance of your DAO call servletContext.getResourceAsStream() and pass
the resulting input stream to your DAO instance.  That might be easily
doable in a ServletContextListener.

--David

Guojun Zhu wrote:
> Hi,
>
> I am using tomat 5.5 in linux/windows mixed environment.  The deploy
> target is both.  I had a DAO module for which I would like to put some
> configuration into a separate file for easy access and modifying.
> However, I have some difficulty to figure out how to put the path in
> the FileInputStream, where I need to use jbdc configuration parameters
> such as driver name, server, user, password.  According to some pages
> I have read, the only reliable way is to use the
> servletContext.getResourceAsStream().  So I need to pass the server
> object into the DAO to get the resource.   However, my DAO module is
> almost independent with other parts in the web application and I would
> also like to use it for other non-web application.  So I would much
> prefer not to pass any servlet into this module and package the
> configuration xml or propety file with this module separately.   How
> should I get those?  Thank you very much.
>
> Sincerely
> Zhu, Guojun
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>   


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to