husted      2002/12/28 16:02:06

  Modified:    doc/userGuide configuration.xml
  Log:
  Add introductory material regarding role of data-sources element.
  
  Revision  Changes    Path
  1.8       +81 -14    jakarta-struts/doc/userGuide/configuration.xml
  
  Index: configuration.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/doc/userGuide/configuration.xml,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- configuration.xml 27 Dec 2002 09:21:36 -0000      1.7
  +++ configuration.xml 29 Dec 2002 00:02:06 -0000      1.8
  @@ -304,7 +304,7 @@
   </section>
   
   <section name="7.2.3 PlugIn Configuration" href="plugin_config">
  -
  +   
       <p>
       Struts PlugIns are configured using the <code>&lt;plug-in&gt;</code>
       element within the Struts configuration file.
  @@ -334,20 +334,80 @@
   
   <section name="7.2.4 Data Source Configuration" href="data-source_config">
   
  -      <p>
  -      Besides the objects related to defining ActionMappings, the Struts
  -      configuration may contain elements that create other useful objects.
  -      </p>
  -
  -      <p>
  -      The <code>&lt;data-sources></code> section, which specifies data sources
  -      that your application can use.
  -      This is how you would specify a basic data source for your application
  -      inside of struts-config.xml:
  -      </p>
  +    <p>
  +    Besides the objects related to defining ActionMappings, the Struts
  +    configuration may contain elements that create other useful objects.
  +    </p>
  +
  +    <p>
  +    The <code>&lt;data-sources></code> section can be used to specify 
  +    a collection of DataSources [javax.sql.DataSource] for the use of your
  +    application. 
  +    Typically, a DataSource represents a connection pool to a database 
  +    or other persistent store. 
  +    As a convenience, the Struts DataSource manager can be used to 
  +    instantiate whatever standard pool your application may need. 
  +    Of course, if your persistence layer provides for its own connections, 
  +    then you do not need to specify a <code>data-sources</code> element.
  +    </p>
  +
  +    <p>
  +    Since DataSource implementations vary in what properties need to be
  +    set, unlike other Struts configuration elements, the 
  +    <code>data-source</code> element does not pre-define a slate of 
  +    properties.
  +    Instead, the generic <code>set-property</code> feature is used to set 
  +    whatever properties your implementation may require. 
  +    Typically, these settings would include:
  +    </p>
  +
  +    <ul>
  +
  +    <li>
  +    A driver class name
  +    </li>
  +
  +    <li>
  +    A url to access the driver
  +    </li>
  +
  +    <li>
  +    A description
  +    </li>
  +
  +    </ul>
  +
  +    <p>
  +    And other sundry properties. 
  +    </p>
  +
  +    <p>
  +    As a further convenience, Struts provides a default DataSource 
  +    implementation, [<code>org.apache.struts.util.GenericDataSource</code>].
  +    The <code>type</code> property can be used to specify another 
  +    implementation: 
  +    </p>
  +
  +<pre><code><![CDATA[
  +<data-source type="org.apache.commons.dbcp.BasicDataSource">
  +<!-- ... set-property elements ... -->        
  +</data-source>
  +]]></code></pre>
  +
  +    <p>        
  +    In Struts 1.1, the GenericDataSource is deprecated, and it is 
  +    recommended that you use the Commons BasicDataSource directly. 
  +    In practice, if you need to use the DataSource manager, you should use 
  +    whatever DataSource implementation works best with your container or 
  +    database. 
  +    </p>
  +      
  +    <p>
  +    This is how you would specify a default data source for your application
  +    inside of struts-config.xml:
  +    </p>
   
   <pre><code><![CDATA[
  -<struts-config>
   <data-sources>
   <!-- configuration for GenericDataSource wrapper -->
   <data-source>
  @@ -376,7 +436,15 @@
       property="user"
       value="myusername"/>
   </data-source>
  +</data-sources>
  +]]></code></pre>
   
  +    <p>
  +    This is how you would specify a DBCP BasicDataSource for your application:
  +    </p>
  +
  +<pre><code><![CDATA[
  +<data-sources>
   <!-- configuration for commons BasicDataSource -->
   <data-source type="org.apache.commons.dbcp.BasicDataSource">
       <set-property
  @@ -400,7 +468,6 @@
   
   </data-source>
   </data-sources>
  -</struts-config>
   ]]></code></pre>
   
       <p>
  
  
  

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

Reply via email to