(DAO = Data Base Access)
.V
Philippe PONSONNET wrote:
This solution seems to be not possible because my Database class is not a Servlet but a classic class. Is it possible to load my resource Database.xml with the web.xml descriptor file ?
And how could I load it with my Database class ?
Thanks
--- Niall Pemberton
<[EMAIL PROTECTED]> a écrit :
You could use the ServletContext's getInputStream("fileName") method
Niall
----- Original Message ----- From: "Philippe PONSONNET" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, December 04, 2004 12:35 AM
Subject: Access to a database with a configuration
file
Hello,
I would like to use a database with struts without
using the default
datasource.
I also would like to configure all acces of this
database with a xml file
named database.xml.
The goal of this is to have a really independant
model.
So I have developped a special class named
Database which uses the
database.xml file for its connection.
All my classes which map a table use this class.
Like that, it is not
nessecary to add some code in my action classes to
connect the database.
But I have a problem when I want to load the
database.xml file : I can't get
its path when my webapp is loaded.
The instruction
getClass().getResource(".").getFile() always return null.
How could I do ?
Thanks in advance and sorry for my poor english.
Philippe
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Découvrez le nouveau Yahoo! Mail : 250 Mo d'espace de stockage pour vos mails ! Créez votre Yahoo! Mail sur http://fr.mail.yahoo.com/ Avec Yahoo! faites un don et soutenez le Téléthon en cliquant sur http://www.telethon.fr/030-Don/10-10_Don.asp
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]