You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by jv...@locus.apache.org on 2000/10/24 19:35:13 UTC
cvs commit: jakarta-velocity/xdocs contributors.xml user-guide.xml vtl-reference-guide.xml
jvanzyl 00/10/24 10:35:12
Modified: xdocs contributors.xml user-guide.xml
vtl-reference-guide.xml
Log:
edits.
Revision Changes Path
1.10 +2 -2 jakarta-velocity/xdocs/contributors.xml
Index: contributors.xml
===================================================================
RCS file: /home/cvs/jakarta-velocity/xdocs/contributors.xml,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- contributors.xml 2000/10/16 05:05:24 1.9
+++ contributors.xml 2000/10/24 17:35:10 1.10
@@ -96,8 +96,8 @@
<tr>
<td>John Castura</td>
- <td><link href="mailto:jcastura@compusense.com">jcastura@compusense.com</link></td>
- <td>Compusense</td>
+ <td><link href="mailto:jcastura@kw.igs.net">jcastura@kw.igs.net</link></td>
+ <td> </td>
<td>Apprentice</td>
</tr>
1.8 +10 -14 jakarta-velocity/xdocs/user-guide.xml
Index: user-guide.xml
===================================================================
RCS file: /home/cvs/jakarta-velocity/xdocs/user-guide.xml,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- user-guide.xml 2000/10/16 04:51:25 1.7
+++ user-guide.xml 2000/10/24 17:35:11 1.8
@@ -7,7 +7,7 @@
<subtitle>Velocity User Guide</subtitle>
<authors>
<person name="Velocity Documentation Team" email="jvanzyl@locus.apache.org"/>
- <person name="John Castura" email="jcastura@compusense.com"/>
+ <person name="John Castura" email="jcastura@kw.igs.net"/>
</authors>
</header>
@@ -224,9 +224,7 @@
<s1 title="VTL Reference">
<p>
- Velocity references its variables in a fashion similar to
- <link href="http://www.perl.com">Perl</link> (i.e. they
- use a <pre>$</pre>), but takes advantage of some Java principles that
+ Velocity references take advantage of some Java principles that
template designers will find easy to use. For example:
</p>
@@ -240,31 +238,29 @@
</p>
<p>
- These examples illustrate alternative uses for the same variables.
+ These examples illustrate alternative uses for the same references.
Velocity takes advantage of Java's introspection and
- bean features to resolve the variable names to both objects in the Context
+ bean features to resolve the reference names to both objects in the Context
as well as the objects methods. It is possible to embed and evaluate
- variables almost anywhere in your template.
+ references almost anywhere in your template.
</p>
<p>
- Everything coming to and from a variable is treated as a String object.
+ Everything coming to and from a reference 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>
- <s1 title="Variables">
-
<p>
- VTL variables can reference three types of objects: variables,
+ There are three types of references in the VTL: variables,
properties, and methods.
<s1 title="Variables">
<p>
- A VTL variable, such as <pre>$foo</pre>, can get its value from
- either a <pre>set</pre> directive in the template, or from the
+ When VTL references a variable, such as <pre>$foo</pre>, the variable can
+ get its value from either a <pre>set</pre> directive in the template, or from the
Java code. For example, if the Java variable <pre>$foo</pre>
has the value <pre>bar</pre> at the time the template is requested,
<pre>bar</pre> replaces all instances of <pre>$foo</pre> on the web
@@ -287,7 +283,7 @@
<s1 title="Properties">
<p>
- The second flavour of VTL variable references properties, and it has
+ The second flavour of VTL references are properties, and properties have
a distinctive format:
</p>
1.9 +36 -47 jakarta-velocity/xdocs/vtl-reference-guide.xml
Index: vtl-reference-guide.xml
===================================================================
RCS file: /home/cvs/jakarta-velocity/xdocs/vtl-reference-guide.xml,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- vtl-reference-guide.xml 2000/10/21 06:23:19 1.8
+++ vtl-reference-guide.xml 2000/10/24 17:35:11 1.9
@@ -33,8 +33,8 @@
<p>
There are three types of references in the VTL: variables, properties
- and methods. As a designer using the VTL, you must come to an agreement
- with your engineers as to what the specific names of references are so
+ and methods. As a designer using the VTL, you and your engineers must
+ come to an agreement on the specific names of references so
you can use them correctly in your templates.
</p>
@@ -46,7 +46,7 @@
an alphabetic character (a .. z or A .. Z), the rest of the
characters must be of the following types: an alphabetic character,
a numeric character (0 .. 9), a hyphen character ("-"),
- or an underscore character ("_"). These are examples of valid
+ or an underscore character ("_"). Here are some examples of valid
variable references in the VTL:
</p>
@@ -102,9 +102,9 @@
$customer.getAddress() and $purchase.getTotal() look very
similiar to the first two example Properties $customer.Address
and $purchase.Total. If you guessed that these examples must
- be related some in some fashion you are correct! VTL Properties
- are simply a shorthand for notation for VTL Methods. Using the
- Property $customer.Address would have the exact same effect as
+ be related some in some fashion, you are correct! VTL Properties
+ are simply a shorthand for notation for VTL Methods. The
+ Property $customer.Address has the exact same effect as
using the Method $customer.getAddress(). It is generally preferable
to use a Property when available. The main difference between Properties
and Methods is that you can specify a parameter list to a Method.
@@ -128,13 +128,13 @@
<p>
In almost all cases you will use the shorthand notation
- for references. But there are some cases where the formal
- notation is required for correct processing. Say you were
+ for references, but in some cases the formal
+ notation is required for correct processing. Suppose you were
constructing a sentence on the fly where $vice was to be
used as the base word in the noun of a sentence. Say you
wanted to allow someone to choose the base word and produce
one of the two following results: "Jack is a pyromaniac." or
- "Jack is a kleptomaniac.". You might have the following in
+ "Jack is a kleptomaniac.". You might attempt to use the following in
a VTL template:
</p>
@@ -145,12 +145,11 @@
</p>
<p>
- But as you might have guessed this will confuse Velocity
- because Velocity can't tell that $vice is the Identifer
- that you mean to use. It will assume that $vicemaniac
+ Velocity can't tell that $vice is the Identifer
+ that you mean to use; it will assume that $vicemaniac
is the Identifier and try to use that to find an appropriate
value. You can get around this problem by using the formal
- notation for a reference:
+ notation for this reference:
</p>
<p>
@@ -160,20 +159,19 @@
</p>
<p>
- Now Velocity knows that you want to use $vice as your
- Identifier and not $vicemaniac. The formal notation usually
- comes in handy when you have references directly ajacent
+ Now Velocity knows that $vice, not $vicemaniac, is your
+ Identifier. The formal notation usually
+ comes in handy when you have references directly adjacent
to text in your templates.
</p>
<p>
<strong>Quiet Reference Notation</strong>
<br/>
- Velocity's normal behavior upon encountering a
- reference that is undefined is to output the image
- of the reference. For example, say you have have
- the following VTL as part of an HTML for you
- want to produce:
+ When Velocity encounters a reference that is undefined,
+ its normal behavior is to output the image
+ of the reference. For example, if you have
+ the following VTL as part of an HTML page:
</p>
<p>
@@ -183,12 +181,11 @@
</p>
<p>
- Now when the form initially loads the variable
- reference $email has no value, but you don't
- want the text field to have a value of "$email"
- it should be blank. To circumvent Velocity's
- normal behavior you use the quiet reference
- notation: so instead of using $email in the
+ When the form initially loads the variable
+ reference $email has no value, but you prefer the
+ a blank text field to one with a value of "$email".
+ Using the quiet reference notation can circumvent Velocity's
+ normal behavior; instead of using $email in the
VTL you would use $!email. So the above example
would look like the following:
</p>
@@ -200,8 +197,8 @@
</p>
<p>
- Now when the form is initially loaded, while
- $email has no value yet, an empty string will
+ Now when the form is initially loaded and
+ $email still has no value, an empty string will
be output instead of "$email".
</p>
@@ -212,8 +209,8 @@
<strong>#set</strong>
<br/>
The #set directive is used for setting the value of
- a reference. The reference being assigned a value can
- either be a variable reference or a property reference:
+ a reference. A value can be assigned to either a variable
+ reference or a property reference:
</p>
<p>
@@ -241,8 +238,8 @@
</p>
<p>
- Here is an example of showing the use of the
- above mentioned types:
+ Here are examples demonstrating the
+ aforementioned types:
</p>
<p>
@@ -272,7 +269,7 @@
<p>
<strong>#foreach</strong>
<br/>
- The #foreach directive provide a simple way of looping
+ The #foreach directive provides a simple way of looping
through a list of objects:
</p>
@@ -313,11 +310,11 @@
<p>
The default name for the loop counter variable
- reference is $velocityCounter, but you can specify
- this in the velocity.properties file. You can also
- specify whether the counter should start at 0 or 1.
- Here's what the properties look like in the
- velocity.properties file:
+ reference, which is specified in the velocity.properties
+ file, is $velocityCount. By default the counter starts
+ at 1, but this can be set to either 0 or 1 in the
+ velocity.properties file. Here's what the loop counter
+ properties section of the velocity.properties file appears:
</p>
<p>
@@ -332,15 +329,7 @@
]]></source>
</p>
-<p>
- <strong>#if/#elseif/#else</strong>
- <br/>
-</p>
-</s1>
-
-<s1 title="Macros">
-</s1>
</body>
</document>