I believe this is a build/deploy question as much as a Struts question. But
here goes:

1. Drive virtually everything from your application.properties file. All
these properties are available to your Action classes. For example, define
the path to your images directory there, the club name, the jdbc url, etc.)

2. Create each site as it's own web app - but keep everything in a SINGLE
SOURCE CONTROL REPOSITORY version. You will create specific sites ONLY AT
BUILD TIME. Again - only one version exists in source control. Call this
The Template.

     This is critical. No site-specific code or properties get checked in
with The Template. Everything is driven from the application.properties
file.

3. Define the values in this application.properties file using "tokens",
not actual values. For example:

     in The Template application.properties for Struts:

     club.name=CLUB_NAME
     path.to.images=IMAGE_PATH
     site.jdbc.url=JDBC_URL

     - etc. -

4. Then, for each actual site, create a seperate "properties" file
containing the specific values for that site. For example:

     in "club1.properties"

     club.name=Fred's Club
     path.to.images=/fredimages/images
     site.jdbc.url="jdbc:oracle:thin:@123.45.67.89:1521:orcl"

     - etc. -

5. At build time, use Ant's "<replace>" target to replace the "tokens" in
the struts application.properties file with the site-specific values from
the site-specific properties files. That is:


          <replace
              file="path/to/struts/application.properties"
              propertyFile="path/to/specific/club.properties" >
            <replacefilter
              token="CLUB_NAME"
              property="club.name"/>
            <replacefilter
              token="IMAGE_PATH"
              property="path.to.images"/>
            <replacefilter
              token="JDBC_URL"
              property="site.jdbc.url"/>
          </replace>


     See details on the Ant <replace> tag at: 
http://jakarta.apache.org/ant/manual/CoreTasks/replace.html

6. Create a different ant target to build each site. And maybe a "build-all" to build 
all the sites.

     There's a bit of work here getting things organized. But this will allow you to 
generate sites from The Template as a build/configuration process
 - not as a development issue.

Summary:

1.   Drive EVERYTHING site specific from the application.properties file
2.   Use tokens in the application.properties file instead of actual values
3.   Create the actual sites at build/deploy time using Ant and the <replace> target.

This will work!


FWIW -
Kevin





Mike Karl <[EMAIL PROTECTED]> on 05/13/2002 04:51:36 PM

Please respond to "Struts Users Mailing List"
      <[EMAIL PROTECTED]>

To:   [EMAIL PROTECTED]
cc:    (bcc: Kevin Bedell/Systems/USHO/SunLife)
Subject:  Multiple sites using one struts application.


Hello,
I'm building a site for a group of clubs.  All the sites will have the
same set of pages and actions.

For instance:

http://clubsites/club1/index.jsp
http://clubsites/club2/index.jsp
http://clubsites/club3/index.jsp
http://anothersite/club4/index.jsp

All of these sites would basically be the same in terms of layout and
functionality except that the would have different images.  They may
also connect to seperate database. How can I set up a site like this so
that I can use the same pages for all of the clubs but pass different
configurations so that I can render the pages with their own images.

thanks
mike



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







---------------------------------------------------------------------------
This e-mail message (including attachments, if any) is intended for the use
of the individual or entity to which it is addressed and may contain
information that is privileged, proprietary , confidential and exempt from
disclosure.  If you are not the intended recipient, you are notified that
any dissemination, distribution or copying of this communication is
strictly prohibited.  If you have received this communication in error,
please notify the sender and erase this e-mail message immediately.
---------------------------------------------------------------------------


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

Reply via email to