[prev in list] [next in list] [prev in thread] [next in thread] 

List:       struts-user
Subject:    Re: struts-config <data-source> c
From:       Morris Jones <mojo () whiteoaks ! com>
Date:       2005-04-28 14:55:09
Message-ID: 4270F94D.4050202 () whiteoaks ! com
[Download RAW message or body]

Anindya Bandyopadhyay wrote:
>  I've developed one small application which will be used in different area 
> using different database connection. I want to make properties file which 
> will say all the value of *<data-source>* in *struts-config* and put the 
> value in *struts-config* when tomcat starts and that's how we can get the 
> right database connection every time. I'm looking for something like this:
[...]
> <set-property property="driverClassName" value="$(DRIVERNAME)" />

I do this in the Ant build by filtering the properties file when you 
build the .war file or copy to the webapps directory.

Here's an example from my build.xml:

     <!-- Copy any resource or configuration files -->
     <target name="resources">
         <filter token="TOMCATHOME" value="${tomcat.home}"/>
         <filter token="TESTHOST" value="${test.host}"/>
         <filter token="SOAPHOST" value="${soap.host}"/>
         <copy todir="WEB-INF/classes" includeEmptyDirs="no" 
filtering="true">
             <fileset dir="WEB-INF/src">
             <patternset>
                 <include name="**/*.conf"/>
                 <include name="**/*.properties"/>
                 <include name="**/*.xml"/>
             </patternset>
             </fileset>
         </copy>
     </target>

And in the properties file:

# Host name part of SOAP server URL
soap.server:@SOAPHOST@

etc.

Mojo
-- 
Morris Jones
Monrovia, CA
http://www.whiteoaks.com
Old Town Astronomers: http://www.otastro.org

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic