and for extra bonus points...

Implement a struts PlugIn with a property torqueConfigFileName - you only
need two methods

   init() - which uses the servlet context to get the real path

        // Figure out where the torque config file is
        ServletContext servletContext = servlet.getServletContext();
                String fname = 
servletContext.getRealPath(this.getTorqueConfigFilename());
                log.info("Initializing Torque from " + fname);

                // Startup torque persistence layer
                Torque.init(fname);

   destroy() - which shuts Torque down nicely

                // We've finished with Torque
                Torque.shutdown();

which means you only have to add the plugin to your struts-config.xml

    <plug-in className="com.kintore.struts.TorqueDatabasePlugIn">
      <set-property property="torqueConfigFilename"
value="/WEB-INF/torque.properties"/>
    </plug-in>


...and put a torque.properties in the right place whenever you want to use
torque in a struts project.

Cheers,
Stuart McGrigor

Guy Galil wrote...
> another alternative when you initiate Torque in  a servlet is to get the
> actual full path from the servlet:

> ServletContext ctxt = getServletContext();
> String path = ctxt.getRealPath("/")+"/WEB-INF/conf/";
> Torque.init(path+"Torque.properties");



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

Reply via email to