Annie,

Write a servlet with an init() method that initializes Torque, and specify
that this servlet should load at startup in your web.xml file. Perhaps you
could turn your existing DataModel class into a servlet for this purpose.
See the ActionServlet stuff in web.xml for how to make a servlet load at
startup (give your servlet a lower number than ActionServlet to make yours
load first).

-Max

----- Original Message -----
From: "Annie Zhang" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Wednesday, April 03, 2002 6:39 PM
Subject: Where can I do some application initialize work?


HI,

I'm using struts & torque together. I put some initialize code in one of my
class as a static code. But these code is not executed until class DataModel
is lodaded. So, if I call any function of Torque, it will report that
"Torque is not initialized".

Where can I put some global initialize code for the application ? Thanks.

Annie

public class DataModel {

  static {
      try{
          Torque.init("piso.properties");
      }
      catch (Exception e)
      {
          e.printStackTrace();
      }
  }





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

Reply via email to