geirm       2003/10/26 03:22:03

  Modified:    xdocs    developer-guide.xml
               docs     developer-guide.html
  Log:
  Doco patch from Anthony Eden showing how to add objects to the
  Velocity props
  
  Revision  Changes    Path
  1.72      +33 -0     jakarta-velocity/xdocs/developer-guide.xml
  
  Index: developer-guide.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity/xdocs/developer-guide.xml,v
  retrieving revision 1.71
  retrieving revision 1.72
  diff -u -r1.71 -r1.72
  --- developer-guide.xml       23 Oct 2003 13:49:28 -0000      1.71
  +++ developer-guide.xml       26 Oct 2003 11:22:03 -0000      1.72
  @@ -1550,6 +1550,39 @@
   If you try this and have a problem, be sure to look at the velocity.log for
   information - the error messages are pretty good for figuring out what is wrong.
   </p>
  +
  +<p>
  +If you need to place objects into the Velocity properties then you cannot use
  +the Velocity.init(Properties p) method.  Instead you should create a new instance
  +of the <code>org.apache.commons.collections.ExtendedProperties</code> class, copy
  +all properties from an existing Properties object into the ExtendedProperties and
  +then add new properties with your objects to the ExtendedProperties object.
  +</p>
  +
  +<source><![CDATA[
  +...
  +
  +    VelocityEngine velocityEngine = new VelocityEngine();
  +    ExtendedProperties eprops = new ExtendedProperties();
  +
  +    // if you already have a Properties object do this
  +    eprops.putAll(props);
  +
  +    // Now set the property with your object instance
  +    eprops.setProperty("name", object);
  +
  +    ...
  +    velocityEngine.setExtendedProperties(eprops);
  +    velocityEngine.init();
  +    ...
  +]]>
  +</source>
  +
  +<p>
  +You may want to also consider using the Application Attributes feature described
  +in the following section.
  +</p>
  +
   </section>
   
   <section name="Application Attributes">
  
  
  
  1.105     +47 -0     jakarta-velocity/docs/developer-guide.html
  
  Index: developer-guide.html
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity/docs/developer-guide.html,v
  retrieving revision 1.104
  retrieving revision 1.105
  diff -u -r1.104 -r1.105
  --- developer-guide.html      23 Oct 2003 13:49:28 -0000      1.104
  +++ developer-guide.html      26 Oct 2003 11:22:03 -0000      1.105
  @@ -1958,6 +1958,53 @@
   If you try this and have a problem, be sure to look at the velocity.log for
   information - the error messages are pretty good for figuring out what is wrong.
   </p>
  +                                                <p>
  +If you need to place objects into the Velocity properties then you cannot use
  +the Velocity.init(Properties p) method.  Instead you should create a new instance
  +of the <code>org.apache.commons.collections.ExtendedProperties</code> class, copy
  +all properties from an existing Properties object into the ExtendedProperties and
  +then add new properties with your objects to the ExtendedProperties object.
  +</p>
  +                                                    <div align="left">
  +    <table cellspacing="4" cellpadding="0" border="0">
  +    <tr>
  +      <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" 
width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  +      <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" 
height="1" vspace="0" hspace="0" border="0"/></td>
  +      <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" 
width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  +    </tr>
  +    <tr>
  +      <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" 
height="1" vspace="0" hspace="0" border="0"/></td>
  +      <td bgcolor="#ffffff"><pre>
  +...
  +
  +    VelocityEngine velocityEngine = new VelocityEngine();
  +    ExtendedProperties eprops = new ExtendedProperties();
  +
  +    // if you already have a Properties object do this
  +    eprops.putAll(props);
  +
  +    // Now set the property with your object instance
  +    eprops.setProperty(&quot;name&quot;, object);
  +
  +    ...
  +    velocityEngine.setExtendedProperties(eprops);
  +    velocityEngine.init();
  +    ...
  +
  +</pre></td>
  +      <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" 
height="1" vspace="0" hspace="0" border="0"/></td>
  +    </tr>
  +    <tr>
  +      <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" 
width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  +      <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" 
height="1" vspace="0" hspace="0" border="0"/></td>
  +      <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" 
width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  +    </tr>
  +    </table>
  +    </div>
  +                                                <p>
  +You may want to also consider using the Application Attributes feature described
  +in the following section.
  +</p>
                               </blockquote>
           </p>
         </td></tr>
  
  
  

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

Reply via email to