Try this (or something close) in your Action code :

String contextRoot = getServlet().getSerlvetContext().getRealPath();
Torque.init(contextRoot+"/WEB-INF/TORQUE.properties");

NB: "getServlet()" should work in 1.02.  I think this may have changed in
1.1b2 -  check the API docs to see how to grab a ref to the ActionServlet
(or ActionSErvletWrapper as it may be now).

HTH

Jin

----- Original Message -----
From: "rickchev" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, September 24, 2002 2:41 AM
Subject: Torque initialization/configuration in a Struts Application


> I'm one of the famous Struts/Torque for dummies.
>
> I have some configuration questions for using torque-3.0.4-b4 and
> Struts-1.1-b2 in the Tomcat-4.1.X environment.
>
> I have generated all of the database classes using the torque utilities
> and have gotten my web app to connect to the database and return rows
> utilizing the classes and the struts framework.  BUT, I know I've set up
> the configuration incorrectly.
>
> Currently I don't have any struts <datasource> definitions in my
> struts-config.xml.  I also have the following in all of my Struts Action
> code: Torque.init("/Rick/myjava/newapp/WEB-INF/TORQUE.properties");.  I
> can't seem to get the Torque .properties to be defined somewhere under
> the WEB-INF structure.  The web app never finds the file if I define it
> as Torque.init("/WEB-INF/TORQUE.properties");
>
> I'm new to all of this, but that can't be the way I'm supposed to do it.
> This leaves the path to the properties file hard-coded into every
> Action.
> Someone please tell me that I have brain damage.  If any of you have
> experience with this configuration, please guide me down the right path.
> I'm too close to using EJB's for an application that I don't think needs
> it.
>
> Any suggestions would be greatly appreciated.
>
> Thanks
> Rick
>
>

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

Reply via email to