jvanzyl     00/10/13 11:52:24

  Added:       docs     developer-guide.html user-guide.html
  Log:
  - added user/developer guides.
  
  Revision  Changes    Path
  1.1                  jakarta-velocity/docs/developer-guide.html
  
  Index: developer-guide.html
  ===================================================================
  <HTML><HEAD><TITLE>Developer's Guide</TITLE></HEAD><BODY alink="#023264" 
bgcolor="#ffffff" leftmargin="4" link="#023264" marginheight="4" marginwidth="4" 
text="#000000" topmargin="4" vlink="#023264"><TABLE border="0" cellpadding="0" 
cellspacing="0" width="100%"><TR><TD align="left" valign="top"><A 
href="http://jakarta.apache.org/index.html"><IMG border="0" hspace="0" 
src="resources/jakarta-logo.gif" vspace="0"></A></TD><TD align="left" 
bgcolor="#ffffff" valign="top" width="100%"><IMG align="right" alt="" border="0" 
hspace="0" src="resources/header.gif" vspace="0"></TD></TR><TR><TD><IMG border="0" 
height="5" hspace="0" src="resources/void.gif" vspace="0" width="5"></TD></TR><TR><TD 
background="resources/line.gif" colspan="2" height="2" width="100%"><IMG alt="" 
border="0" height="2" hspace="0" src="resources/line.gif" vspace="0" 
width="1"></TD></TR></TABLE><TABLE border="0" cellpadding="0" cellspacing="0" 
width="100%"><TR><TD valign="top" width="1%"></TD><TD nowrap="1" valign="top" 
width="14%"><BR>
  
  <P></P>
      <FONT face="arial,helvetica,sanserif" size="-1"><LI><A 
href="index.html">Overview</A></LI></FONT>
      <FONT face="arial,helvetica,sanserif" size="-1"><LI><A 
href="getting-started.html">Getting Started</A></LI></FONT>
      <FONT face="arial,helvetica,sanserif" size="-1"><LI><A 
href="install.html">Install</A></LI></FONT>
      <FONT face="arial,helvetica,sanserif" size="-1"><LI><A 
href="design.html">Design</A></LI></FONT>
      <FONT face="arial,helvetica,sanserif" size="-1"><LI><A 
href="contributors.html">Contributors</A></LI></FONT>
      <FONT face="arial,helvetica,sanserif" size="-1"><LI><A 
href="code-standards.html">Coding Standards</A></LI></FONT>
      <FONT face="arial,helvetica,sanserif" size="-1"><LI><A 
href="license.html">License</A></LI></FONT>
      <FONT face="arial,helvetica,sanserif" size="-1"><LI><A 
href="todo.html">TODO</A></LI></FONT>
      <P></P>
      <FONT face="arial,helvetica,sanserif" size="-1"><LI><A 
href="user-guide.html">User's Guide</A></LI></FONT>
      <FONT face="arial,helvetica,sanserif" size="-1"><LI><A 
href="developer-guide.html">Developer's Guide</A></LI></FONT>
  </TD><TD align="left" valign="top" width="*"><TABLE border="0" cellpadding="3" 
cellspacing="0"><TR><TD><BR>
  
   
  
  
  
  <DIV align="right"><TABLE border="0" cellpadding="0" cellspacing="0" 
width="98%"><TR><TD bgcolor="#023264" width="100%"><FONT color="#ffffff" 
face="arial,helvetica,sanserif" size="+1"><IMG border="0" height="5" hspace="0" 
src="resources/void.gif" vspace="0" width="5"><B>User's 
Guide</B></FONT></TD></TR><TR><TD><IMG border="0" height="5" hspace="0" 
src="resources/void.gif" vspace="0" width="1"></TD></TR></TABLE><TABLE border="0" 
cellpadding="0" cellspacing="0" width="98%"><TR><TD><FONT color="#000000" 
face="arial,helvetica,sanserif">
  
  <P align="justify">
      This is still in progress. It will be here soon.
  </P>
  
  </FONT></TD></TR></TABLE></DIV><BR>
  
  
  </TD></TR></TABLE></TD></TR></TABLE><BR><TABLE border="0" cellpadding="0" 
cellspacing="0" width="100%"><TR><TD bgcolor="#023264"><IMG height="1" 
src="resources/resources.gif" width="1"></TD></TR><TR><TD align="center"><FONT 
color="#023264" face="arial,helvetica,sanserif" size="-1"><I>
                Copyright &copy; 2000 The Apache Software Foundation.
                All Rights Reserved.
              </I></FONT></TD></TR></TABLE></BODY></HTML>
  
  
  1.1                  jakarta-velocity/docs/user-guide.html
  
  Index: user-guide.html
  ===================================================================
  <HTML><HEAD><TITLE>Velocity User's Guide</TITLE></HEAD><BODY alink="#023264" 
bgcolor="#ffffff" leftmargin="4" link="#023264" marginheight="4" marginwidth="4" 
text="#000000" topmargin="4" vlink="#023264"><TABLE border="0" cellpadding="0" 
cellspacing="0" width="100%"><TR><TD align="left" valign="top"><A 
href="http://jakarta.apache.org/index.html"><IMG border="0" hspace="0" 
src="resources/jakarta-logo.gif" vspace="0"></A></TD><TD align="left" 
bgcolor="#ffffff" valign="top" width="100%"><IMG align="right" alt="" border="0" 
hspace="0" src="resources/header.gif" vspace="0"></TD></TR><TR><TD><IMG border="0" 
height="5" hspace="0" src="resources/void.gif" vspace="0" width="5"></TD></TR><TR><TD 
background="resources/line.gif" colspan="2" height="2" width="100%"><IMG alt="" 
border="0" height="2" hspace="0" src="resources/line.gif" vspace="0" 
width="1"></TD></TR></TABLE><TABLE border="0" cellpadding="0" cellspacing="0" 
width="100%"><TR><TD valign="top" width="1%"></TD><TD nowrap="1" valign="top" 
width="14%"><BR>
  
  <P></P>
      <FONT face="arial,helvetica,sanserif" size="-1"><LI><A 
href="index.html">Overview</A></LI></FONT>
      <FONT face="arial,helvetica,sanserif" size="-1"><LI><A 
href="getting-started.html">Getting Started</A></LI></FONT>
      <FONT face="arial,helvetica,sanserif" size="-1"><LI><A 
href="install.html">Install</A></LI></FONT>
      <FONT face="arial,helvetica,sanserif" size="-1"><LI><A 
href="design.html">Design</A></LI></FONT>
      <FONT face="arial,helvetica,sanserif" size="-1"><LI><A 
href="contributors.html">Contributors</A></LI></FONT>
      <FONT face="arial,helvetica,sanserif" size="-1"><LI><A 
href="code-standards.html">Coding Standards</A></LI></FONT>
      <FONT face="arial,helvetica,sanserif" size="-1"><LI><A 
href="license.html">License</A></LI></FONT>
      <FONT face="arial,helvetica,sanserif" size="-1"><LI><A 
href="todo.html">TODO</A></LI></FONT>
      <P></P>
      <FONT face="arial,helvetica,sanserif" size="-1"><LI><A 
href="user-guide.html">User's Guide</A></LI></FONT>
      <FONT face="arial,helvetica,sanserif" size="-1"><LI><A 
href="developer-guide.html">Developer's Guide</A></LI></FONT>
  </TD><TD align="left" valign="top" width="*"><TABLE border="0" cellpadding="3" 
cellspacing="0"><TR><TD><BR>
  
   
  
  
  
  <DIV align="right"><TABLE border="0" cellpadding="0" cellspacing="0" 
width="98%"><TR><TD bgcolor="#023264" width="100%"><FONT color="#ffffff" 
face="arial,helvetica,sanserif" size="+1"><IMG border="0" height="5" hspace="0" 
src="resources/void.gif" vspace="0" width="5"><B>User's 
Guide</B></FONT></TD></TR><TR><TD><IMG border="0" height="5" hspace="0" 
src="resources/void.gif" vspace="0" width="1"></TD></TR></TABLE><TABLE border="0" 
cellpadding="0" cellspacing="0" width="98%"><TR><TD><FONT color="#000000" 
face="arial,helvetica,sanserif">
  
  <P align="justify">
      This guide is meant to provide an easy way for designers
      to get aquainted with Velocity. Velocity may be used as a
      stand-alone servlet framework, or may be used in conjuction
      with another servlet framework like 
      <A href="http://java.apache.org/turbine/">Turbine</A>,
      but in both cases a designer will be using the Velocity
      Template Language (VTL) to incorporate dynamic content
      into a site design.
  </P>
  
  <P align="justify">
      The VTL is meant to provide the easiest, simplest, and
      cleanest way to render dynamic content in a page design.
  </P>
  
  </FONT></TD></TR></TABLE></DIV><BR>
  
  <DIV align="right"><TABLE border="0" cellpadding="0" cellspacing="0" 
width="98%"><TR><TD bgcolor="#023264" width="100%"><FONT color="#ffffff" 
face="arial,helvetica,sanserif" size="+1"><IMG border="0" height="5" hspace="0" 
src="resources/void.gif" vspace="0" width="5"><B>VTL 
Reference</B></FONT></TD></TR><TR><TD><IMG border="0" height="5" hspace="0" 
src="resources/void.gif" vspace="0" width="1"></TD></TR></TABLE><TABLE border="0" 
cellpadding="0" cellspacing="0" width="98%"><TR><TD><FONT color="#000000" 
face="arial,helvetica,sanserif">
  
      <DIV align="right"><TABLE border="0" cellpadding="0" cellspacing="0" 
width="98%"><TR><TD bgcolor="#023264" width="100%"><FONT color="#ffffff" 
face="arial,helvetica,sanserif" size="+1"><IMG border="0" height="5" hspace="0" 
src="resources/void.gif" vspace="0" 
width="5"><B>Variables</B></FONT></TD></TR><TR><TD><IMG border="0" height="5" 
hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR></TABLE><TABLE 
border="0" cellpadding="0" cellspacing="0" width="98%"><TR><TD><FONT color="#000000" 
face="arial,helvetica,sanserif">
  
      <P align="justify">
      Velocity references its variables in a fashion similar to Perl (i.e. they 
      use a $), but takes advantage of some Java principles that template 
      designers will find easy to use. For example:
      </P>
  
      <P align="justify">
      <DIV align="center"><TABLE border="0" cellpadding="0" cellspacing="4"><TR><TD 
bgcolor="#023264" height="1" width="1"><IMG border="0" height="1" hspace="0" 
src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#023264" 
height="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" 
width="1"></TD><TD bgcolor="#023264" height="1" width="1"><IMG border="0" height="1" 
hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD 
bgcolor="#023264" width="1"><IMG border="0" height="1" hspace="0" 
src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#ffffff"><PRE>
      $foo
      $foo.getBar() or $foo.Bar
      $data.getUser(&quot;jon&quot;) or $data.User(&quot;jon&quot;)
      $data.getRequest().getServerName() or $data.Request.ServerName</PRE></TD><TD 
bgcolor="#023264" width="1"><IMG border="0" height="1" hspace="0" 
src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD bgcolor="#023264" 
height="1" width="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" 
vspace="0" width="1"></TD><TD bgcolor="#023264" height="1"><IMG border="0" height="1" 
hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#023264" 
height="1" width="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" 
vspace="0" width="1"></TD></TR></TABLE></DIV>
      </P>
  
      <P align="justify">
      These examples illustrate alternative uses for the same variables. 
      Velocity takes advantage of Java's introspection and 
      bean features to resolve the variable names to both objects in the Context 
      as well as the objects methods. It is possible to embed variables almost
      anywhere in your template. These variables can be evaluated.
      </P>
      
      <P align="justify">
      Everything coming to and from a variable is treated as a String object. 
      If there is an object that represents $foo (such as an Integer object), 
      then Velocity will call its .toString() method to resolve the 
      object into a String.
      </P>
      </FONT></TD></TR></TABLE></DIV><BR>
  
      <DIV align="right"><TABLE border="0" cellpadding="0" cellspacing="0" 
width="98%"><TR><TD bgcolor="#023264" width="100%"><FONT color="#ffffff" 
face="arial,helvetica,sanserif" size="+1"><IMG border="0" height="5" hspace="0" 
src="resources/void.gif" vspace="0" 
width="5"><B>Conditionals</B></FONT></TD></TR><TR><TD><IMG border="0" height="5" 
hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR></TABLE><TABLE 
border="0" cellpadding="0" cellspacing="0" width="98%"><TR><TD><FONT color="#000000" 
face="arial,helvetica,sanserif">
  
      <DIV align="right"><TABLE border="0" cellpadding="0" cellspacing="0" 
width="98%"><TR><TD bgcolor="#023264" width="100%"><FONT color="#ffffff" 
face="arial,helvetica,sanserif" size="+1"><IMG border="0" height="5" hspace="0" 
src="resources/void.gif" vspace="0" width="5"><B>If / ElseIf / Else 
Conditionals</B></FONT></TD></TR><TR><TD><IMG border="0" height="5" hspace="0" 
src="resources/void.gif" vspace="0" width="1"></TD></TR></TABLE><TABLE border="0" 
cellpadding="0" cellspacing="0" width="98%"><TR><TD><FONT color="#000000" 
face="arial,helvetica,sanserif">
      <P align="justify">
      The #if statement in Velocity allows for text in the brackets to be 
      included in the text, on the conditional that the if statement
      is true. For example:
      </P>
  
      <P align="justify">
      <DIV align="center"><TABLE border="0" cellpadding="0" cellspacing="4"><TR><TD 
bgcolor="#023264" height="1" width="1"><IMG border="0" height="1" hspace="0" 
src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#023264" 
height="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" 
width="1"></TD><TD bgcolor="#023264" height="1" width="1"><IMG border="0" height="1" 
hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD 
bgcolor="#023264" width="1"><IMG border="0" height="1" hspace="0" 
src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#ffffff"><PRE>
      #if ($foo)
          &lt;strong&gt;Velocity Rocks!&lt;/strong&gt;
      #end
      </PRE></TD><TD bgcolor="#023264" width="1"><IMG border="0" height="1" hspace="0" 
src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD bgcolor="#023264" 
height="1" width="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" 
vspace="0" width="1"></TD><TD bgcolor="#023264" height="1"><IMG border="0" height="1" 
hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#023264" 
height="1" width="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" 
vspace="0" width="1"></TD></TR></TABLE></DIV>
      </P>
  
      <P align="justify">
      The variable $foo is evaluated to see if it is a boolean or not null; the 
      content within the brackets becomes the output if the evaluation is true. 
      Unlike in JSP, Velocity does not force web developers to wrap HTML code 
      within an out.println(), or to delve into ugly workarounds to out.println().
      </P>
      
      <P align="justify">
      An #elseif or #else element can be used with an #if element.
      </P>
  
      <P align="justify">
      <DIV align="center"><TABLE border="0" cellpadding="0" cellspacing="4"><TR><TD 
bgcolor="#023264" height="1" width="1"><IMG border="0" height="1" hspace="0" 
src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#023264" 
height="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" 
width="1"></TD><TD bgcolor="#023264" height="1" width="1"><IMG border="0" height="1" 
hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD 
bgcolor="#023264" width="1"><IMG border="0" height="1" hspace="0" 
src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#ffffff"><PRE>
      #if ($foo)
          &lt;strong&gt;Velocity Rocks!&lt;/strong&gt;
      #elseif($bar)
          &lt;strong&gt;Velocity Rocks Again!&lt;/strong&gt;
      #else
          &lt;strong&gt;Velocity Still Rocks!&lt;/strong&gt;
      #end
      </PRE></TD><TD bgcolor="#023264" width="1"><IMG border="0" height="1" hspace="0" 
src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD bgcolor="#023264" 
height="1" width="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" 
vspace="0" width="1"></TD><TD bgcolor="#023264" height="1"><IMG border="0" height="1" 
hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#023264" 
height="1" width="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" 
vspace="0" width="1"></TD></TR></TABLE></DIV>
      </P>
      
      <P align="justify">
      In this example, if $foo is false, then the output will be
      <B>Velocity Still Rocks!</B> 
      </P>
  
      <P align="justify">
      Note that logical operators are not yet available in Velocity. 
      This functionality is expected to be added soon. An example of
      a logical operator is shown below.
      </P>
  
      <P align="justify">
      <DIV align="center"><TABLE border="0" cellpadding="0" cellspacing="4"><TR><TD 
bgcolor="#023264" height="1" width="1"><IMG border="0" height="1" hspace="0" 
src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#023264" 
height="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" 
width="1"></TD><TD bgcolor="#023264" height="1" width="1"><IMG border="0" height="1" 
hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD 
bgcolor="#023264" width="1"><IMG border="0" height="1" hspace="0" 
src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#ffffff"><PRE>
      #if ($foo &amp;&amp; $bar)
          &lt;strong&gt;Velocity Rocks!&lt;/strong&gt;
      #end
      </PRE></TD><TD bgcolor="#023264" width="1"><IMG border="0" height="1" hspace="0" 
src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD bgcolor="#023264" 
height="1" width="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" 
vspace="0" width="1"></TD><TD bgcolor="#023264" height="1"><IMG border="0" height="1" 
hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#023264" 
height="1" width="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" 
vspace="0" width="1"></TD></TR></TABLE></DIV>
      </P>
      </FONT></TD></TR></TABLE></DIV><BR>
  </FONT></TD></TR></TABLE></DIV><BR>
  
  <DIV align="right"><TABLE border="0" cellpadding="0" cellspacing="0" 
width="98%"><TR><TD bgcolor="#023264" width="100%"><FONT color="#ffffff" 
face="arial,helvetica,sanserif" size="+1"><IMG border="0" height="5" hspace="0" 
src="resources/void.gif" vspace="0" 
width="5"><B>Loops</B></FONT></TD></TR><TR><TD><IMG border="0" height="5" hspace="0" 
src="resources/void.gif" vspace="0" width="1"></TD></TR></TABLE><TABLE border="0" 
cellpadding="0" cellspacing="0" width="98%"><TR><TD><FONT color="#000000" 
face="arial,helvetica,sanserif">
      <DIV align="right"><TABLE border="0" cellpadding="0" cellspacing="0" 
width="98%"><TR><TD bgcolor="#023264" width="100%"><FONT color="#ffffff" 
face="arial,helvetica,sanserif" size="+1"><IMG border="0" height="5" hspace="0" 
src="resources/void.gif" vspace="0" width="5"><B>Foreach 
Loop</B></FONT></TD></TR><TR><TD><IMG border="0" height="5" hspace="0" 
src="resources/void.gif" vspace="0" width="1"></TD></TR></TABLE><TABLE border="0" 
cellpadding="0" cellspacing="0" width="98%"><TR><TD><FONT color="#000000" 
face="arial,helvetica,sanserif">
      <P align="justify">
      The #foreach element allows for looping. For example:
      </P>
  
      <P align="justify">
      <DIV align="center"><TABLE border="0" cellpadding="0" cellspacing="4"><TR><TD 
bgcolor="#023264" height="1" width="1"><IMG border="0" height="1" hspace="0" 
src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#023264" 
height="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" 
width="1"></TD><TD bgcolor="#023264" height="1" width="1"><IMG border="0" height="1" 
hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD 
bgcolor="#023264" width="1"><IMG border="0" height="1" hspace="0" 
src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#ffffff"><PRE>
      &lt;ul&gt;
      #foreach ($product in $allProducts)
          &lt;li&gt;$product&lt;/li&gt;
      #end
      &lt;/ul&gt;
      </PRE></TD><TD bgcolor="#023264" width="1"><IMG border="0" height="1" hspace="0" 
src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD bgcolor="#023264" 
height="1" width="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" 
vspace="0" width="1"></TD><TD bgcolor="#023264" height="1"><IMG border="0" height="1" 
hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#023264" 
height="1" width="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" 
vspace="0" width="1"></TD></TR></TABLE></DIV>
      </P>
  
      <P align="justify">
      This #foreach loop causes the $allProducts list (the object) to be 
      looped over for all of the products (targets) in the list. Each time 
      through the loop, the value from $allProducts is placed into the 
      $product variable.
      </P>
      
      <P align="justify">
      The contents of the $allProducts variable is either a Vector, a Hashtable 
      or an Array. The value assigned to the $product variable is a Java
      Object and can be referenced from a variable as such. For example, if 
      $product was really a Product class in Java, its name could be retrieved
      by referencing the $product.Name method (ie: Product.getName()).
      </P>
      </FONT></TD></TR></TABLE></DIV><BR>
  </FONT></TD></TR></TABLE></DIV><BR>    
  
  <DIV align="right"><TABLE border="0" cellpadding="0" cellspacing="0" 
width="98%"><TR><TD bgcolor="#023264" width="100%"><FONT color="#ffffff" 
face="arial,helvetica,sanserif" size="+1"><IMG border="0" height="5" hspace="0" 
src="resources/void.gif" vspace="0" 
width="5"><B>Include</B></FONT></TD></TR><TR><TD><IMG border="0" height="5" hspace="0" 
src="resources/void.gif" vspace="0" width="1"></TD></TR></TABLE><TABLE border="0" 
cellpadding="0" cellspacing="0" width="98%"><TR><TD><FONT color="#000000" 
face="arial,helvetica,sanserif">
      <P align="justify">
      The #include script element allows the template designer to import a 
      local file, which is then inserted into the location where the #include 
      directive is defined. The contents of the file are not rendered through 
      the template engine.
      </P>
      
      <P align="justify">
      <DIV align="center"><TABLE border="0" cellpadding="0" cellspacing="4"><TR><TD 
bgcolor="#023264" height="1" width="1"><IMG border="0" height="1" hspace="0" 
src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#023264" 
height="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" 
width="1"></TD><TD bgcolor="#023264" height="1" width="1"><IMG border="0" height="1" 
hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD 
bgcolor="#023264" width="1"><IMG border="0" height="1" hspace="0" 
src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#ffffff"><PRE>
      #include /path/to/file.vm
      </PRE></TD><TD bgcolor="#023264" width="1"><IMG border="0" height="1" hspace="0" 
src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD bgcolor="#023264" 
height="1" width="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" 
vspace="0" width="1"></TD><TD bgcolor="#023264" height="1"><IMG border="0" height="1" 
hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#023264" 
height="1" width="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" 
vspace="0" width="1"></TD></TR></TABLE></DIV>
      </P>
  </FONT></TD></TR></TABLE></DIV><BR>
  
  <DIV align="right"><TABLE border="0" cellpadding="0" cellspacing="0" 
width="98%"><TR><TD bgcolor="#023264" width="100%"><FONT color="#ffffff" 
face="arial,helvetica,sanserif" size="+1"><IMG border="0" height="5" hspace="0" 
src="resources/void.gif" vspace="0" width="5"><B>Set</B></FONT></TD></TR><TR><TD><IMG 
border="0" height="5" hspace="0" src="resources/void.gif" vspace="0" 
width="1"></TD></TR></TABLE><TABLE border="0" cellpadding="0" cellspacing="0" 
width="98%"><TR><TD><FONT color="#000000" face="arial,helvetica,sanserif">
      <P align="justify">
      The #set script element allows the template designer to set variables 
      within the Context.
      </P>
      
      <P align="justify">
      <DIV align="center"><TABLE border="0" cellpadding="0" cellspacing="4"><TR><TD 
bgcolor="#023264" height="1" width="1"><IMG border="0" height="1" hspace="0" 
src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#023264" 
height="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" 
width="1"></TD><TD bgcolor="#023264" height="1" width="1"><IMG border="0" height="1" 
hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD 
bgcolor="#023264" width="1"><IMG border="0" height="1" hspace="0" 
src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#ffffff"><PRE>
      #set $name = &quot;Fred&quot;
      </PRE></TD><TD bgcolor="#023264" width="1"><IMG border="0" height="1" hspace="0" 
src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD bgcolor="#023264" 
height="1" width="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" 
vspace="0" width="1"></TD><TD bgcolor="#023264" height="1"><IMG border="0" height="1" 
hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#023264" 
height="1" width="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" 
vspace="0" width="1"></TD></TR></TABLE></DIV>
      </P>
      
      <P align="justify">
      When using the #set directive, the variable on the left side must be 
      prefixed with a $. This provides a 
      consistent syntax for referencing variables in Velocity.
      </P>
      
      <P align="justify">
      The following script elements have not been implemented.
      </P>
  </FONT></TD></TR></TABLE></DIV><BR>
  
  <DIV align="right"><TABLE border="0" cellpadding="0" cellspacing="0" 
width="98%"><TR><TD bgcolor="#023264" width="100%"><FONT color="#ffffff" 
face="arial,helvetica,sanserif" size="+1"><IMG border="0" height="5" hspace="0" 
src="resources/void.gif" vspace="0" 
width="5"><B>Comments</B></FONT></TD></TR><TR><TD><IMG border="0" height="5" 
hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR></TABLE><TABLE 
border="0" cellpadding="0" cellspacing="0" width="98%"><TR><TD><FONT color="#000000" 
face="arial,helvetica,sanserif">
      <P align="justify">
      There are three comment types that allow the template designer to 
      place descriptive text in templates that is not placed into the
      output of the template engine.
      </P>
      
      <P align="justify">
      <DIV align="center"><TABLE border="0" cellpadding="0" cellspacing="4"><TR><TD 
bgcolor="#023264" height="1" width="1"><IMG border="0" height="1" hspace="0" 
src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#023264" 
height="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" 
width="1"></TD><TD bgcolor="#023264" height="1" width="1"><IMG border="0" height="1" 
hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD 
bgcolor="#023264" width="1"><IMG border="0" height="1" hspace="0" 
src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#ffffff"><PRE>
      ## this is a line comment
      </PRE></TD><TD bgcolor="#023264" width="1"><IMG border="0" height="1" hspace="0" 
src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD bgcolor="#023264" 
height="1" width="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" 
vspace="0" width="1"></TD><TD bgcolor="#023264" height="1"><IMG border="0" height="1" 
hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#023264" 
height="1" width="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" 
vspace="0" width="1"></TD></TR></TABLE></DIV>
      </P>
  
      <P align="justify">
      <DIV align="center"><TABLE border="0" cellpadding="0" cellspacing="4"><TR><TD 
bgcolor="#023264" height="1" width="1"><IMG border="0" height="1" hspace="0" 
src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#023264" 
height="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" 
width="1"></TD><TD bgcolor="#023264" height="1" width="1"><IMG border="0" height="1" 
hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD 
bgcolor="#023264" width="1"><IMG border="0" height="1" hspace="0" 
src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#ffffff"><PRE>
      #*
      
      This is a multiline
      block comment used for
      longer descriptions.
      
      *#
      </PRE></TD><TD bgcolor="#023264" width="1"><IMG border="0" height="1" hspace="0" 
src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD bgcolor="#023264" 
height="1" width="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" 
vspace="0" width="1"></TD><TD bgcolor="#023264" height="1"><IMG border="0" height="1" 
hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#023264" 
height="1" width="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" 
vspace="0" width="1"></TD></TR></TABLE></DIV>
      </P>
  
      <P align="justify">
      <DIV align="center"><TABLE border="0" cellpadding="0" cellspacing="4"><TR><TD 
bgcolor="#023264" height="1" width="1"><IMG border="0" height="1" hspace="0" 
src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#023264" 
height="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" 
width="1"></TD><TD bgcolor="#023264" height="1" width="1"><IMG border="0" height="1" 
hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD 
bgcolor="#023264" width="1"><IMG border="0" height="1" hspace="0" 
src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#ffffff"><PRE>
      #** 
      
      This is a VelociDoc comment block and
      may be used to store author and versioning
      information:
      
      @author Designer Dude
      @version 5
      
      *#
      </PRE></TD><TD bgcolor="#023264" width="1"><IMG border="0" height="1" hspace="0" 
src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD bgcolor="#023264" 
height="1" width="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" 
vspace="0" width="1"></TD><TD bgcolor="#023264" height="1"><IMG border="0" height="1" 
hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#023264" 
height="1" width="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" 
vspace="0" width="1"></TD></TR></TABLE></DIV>
      </P>
  
  </FONT></TD></TR></TABLE></DIV><BR>
  
  <DIV align="right"><TABLE border="0" cellpadding="0" cellspacing="0" 
width="98%"><TR><TD bgcolor="#023264" width="100%"><FONT color="#ffffff" 
face="arial,helvetica,sanserif" size="+1"><IMG border="0" height="5" hspace="0" 
src="resources/void.gif" vspace="0" width="5"><B>Stop</B></FONT></TD></TR><TR><TD><IMG 
border="0" height="5" hspace="0" src="resources/void.gif" vspace="0" 
width="1"></TD></TR></TABLE><TABLE border="0" cellpadding="0" cellspacing="0" 
width="98%"><TR><TD><FONT color="#000000" face="arial,helvetica,sanserif">
      <P align="justify">
      The #stop script element allows the template designer to stop the execution
      of the template engine and return. This is useful for debugging purposes.
      </P>
      
      <P align="justify">
      <DIV align="center"><TABLE border="0" cellpadding="0" cellspacing="4"><TR><TD 
bgcolor="#023264" height="1" width="1"><IMG border="0" height="1" hspace="0" 
src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#023264" 
height="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" 
width="1"></TD><TD bgcolor="#023264" height="1" width="1"><IMG border="0" height="1" 
hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD 
bgcolor="#023264" width="1"><IMG border="0" height="1" hspace="0" 
src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#ffffff"><PRE>
      #stop
      </PRE></TD><TD bgcolor="#023264" width="1"><IMG border="0" height="1" hspace="0" 
src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD bgcolor="#023264" 
height="1" width="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" 
vspace="0" width="1"></TD><TD bgcolor="#023264" height="1"><IMG border="0" height="1" 
hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#023264" 
height="1" width="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" 
vspace="0" width="1"></TD></TR></TABLE></DIV>
      </P>    
  </FONT></TD></TR></TABLE></DIV><BR>
  
  <DIV align="right"><TABLE border="0" cellpadding="0" cellspacing="0" 
width="98%"><TR><TD bgcolor="#023264" width="100%"><FONT color="#ffffff" 
face="arial,helvetica,sanserif" size="+1"><IMG border="0" height="5" hspace="0" 
src="resources/void.gif" vspace="0" 
width="5"><B>Macro</B></FONT></TD></TR><TR><TD><IMG border="0" height="5" hspace="0" 
src="resources/void.gif" vspace="0" width="1"></TD></TR></TABLE><TABLE border="0" 
cellpadding="0" cellspacing="0" width="98%"><TR><TD><FONT color="#000000" 
face="arial,helvetica,sanserif">
      <P align="justify">
      With the #macro script element, the template designer can define a 
      time-saving macro. 
      </P>    
      
      <P align="justify">
      <DIV align="center"><TABLE border="0" cellpadding="0" cellspacing="4"><TR><TD 
bgcolor="#023264" height="1" width="1"><IMG border="0" height="1" hspace="0" 
src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#023264" 
height="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" 
width="1"></TD><TD bgcolor="#023264" height="1" width="1"><IMG border="0" height="1" 
hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD 
bgcolor="#023264" width="1"><IMG border="0" height="1" hspace="0" 
src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#ffffff"><PRE>
      #macro (row $content) &lt;tr&gt;&lt;td&gt;$content&lt;/td&gt;&lt;/tr&gt; #end
      </PRE></TD><TD bgcolor="#023264" width="1"><IMG border="0" height="1" hspace="0" 
src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD bgcolor="#023264" 
height="1" width="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" 
vspace="0" width="1"></TD><TD bgcolor="#023264" height="1"><IMG border="0" height="1" 
hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#023264" 
height="1" width="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" 
vspace="0" width="1"></TD></TR></TABLE></DIV>
      </P>
      
      <P align="justify">
      This establishes a macro called &quot;row&quot;, which uses HTML tags to
      put content into its own table data cell in an HTML table. Having 
      defined the #row macro, the template designer can now call the #row 
      macro by name.
      </P>
      
      <P align="justify">
      <DIV align="center"><TABLE border="0" cellpadding="0" cellspacing="4"><TR><TD 
bgcolor="#023264" height="1" width="1"><IMG border="0" height="1" hspace="0" 
src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#023264" 
height="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" 
width="1"></TD><TD bgcolor="#023264" height="1" width="1"><IMG border="0" height="1" 
hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD 
bgcolor="#023264" width="1"><IMG border="0" height="1" hspace="0" 
src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#ffffff"><PRE>
      &lt;table&gt;
      #foreach ($element in $list)
        #row ($element)
      #end
      &lt;/table&gt;
      </PRE></TD><TD bgcolor="#023264" width="1"><IMG border="0" height="1" hspace="0" 
src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD bgcolor="#023264" 
height="1" width="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" 
vspace="0" width="1"></TD><TD bgcolor="#023264" height="1"><IMG border="0" height="1" 
hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#023264" 
height="1" width="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" 
vspace="0" width="1"></TD></TR></TABLE></DIV>
      </P>
      
      <P align="justify">
      Here a newly created #row macro is nested inside a #foreach
      statement. As the #foreach statement loops through each $element
      target in the $list object, the #row macro will take the value of
      $element and put it into its table data cell.
      </P>
      
  </FONT></TD></TR></TABLE></DIV><BR>
  
  </FONT></TD></TR></TABLE></DIV><BR>
  
  
  </TD></TR></TABLE></TD></TR></TABLE><BR><TABLE border="0" cellpadding="0" 
cellspacing="0" width="100%"><TR><TD bgcolor="#023264"><IMG height="1" 
src="resources/resources.gif" width="1"></TD></TR><TR><TD align="center"><FONT 
color="#023264" face="arial,helvetica,sanserif" size="-1"><I>
                Copyright &copy; 2000 The Apache Software Foundation.
                All Rights Reserved.
              </I></FONT></TD></TR></TABLE></BODY></HTML>
  
  

Reply via email to