geirm 2003/10/23 06:50:08
Modified: xdocs user-guide.xml
docs user-guide.html
Log:
update - noted how Map syntax works
Revision Changes Path
1.65 +49 -38 jakarta-velocity/xdocs/user-guide.xml
Index: user-guide.xml
===================================================================
RCS file: /home/cvs/jakarta-velocity/xdocs/user-guide.xml,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -r1.64 -r1.65
--- user-guide.xml 17 Apr 2002 19:38:52 -0000 1.64
+++ user-guide.xml 23 Oct 2003 13:50:07 -0000 1.65
@@ -823,6 +823,7 @@
<li>Method reference</li>
<li>Number literal</li>
<li>ArrayList</li>
+ <li>Map</li>
</ul>
</p>
@@ -837,15 +838,25 @@
#set( $monkey.Plan = $spindoctor.weave($web) ) ## method reference
#set( $monkey.Number = 123 ) ##number literal
#set( $monkey.Say = ["Not", $my, "fault"] ) ## ArrayList
+#set( $monkey.Map = ["bannana" : "good", "roast beef" : "bad"]) ## Map
]]></source>
<p>
- NOTE: In the last example the elements defined with the
+ NOTE: For the ArrayList example the elements defined with the
[..] operator are accessible using the methods defined
in the ArrayList class. So, for example, you could access
the first element above using $monkey.Say.get(0).
</p>
+ <p>
+ Similarly, for the Map example, the elements defined within the
+ [..] operator are accessible using the methods defined
+ in the Map class. So, for example, you could access
+ the first element above using $monkey.Map.get("bannana") to return
+ a String 'good', or even $monkey.Map.bannana to return the
+ same value.
+ </p>
+
<p>
The RHS can also be a simple arithmetic expression:
@@ -1084,25 +1095,25 @@
]]></source>
<p>
- Velocity has logical AND, OR and NOT operators as well.
- For further information, please see the
+ Velocity has logical AND, OR and NOT operators as well.
+ For further information, please see the
<a href="vtl-reference-guide.html">VTL Reference Guide</a>
- Below are examples demonstrating the use of the
+ Below are examples demonstrating the use of the
logical AND, OR and NOT operators.
</p>
-<source><![CDATA[
-
-## logical AND
+<source><![CDATA[
+
+## logical AND
#if( $foo && $bar )
<strong> This AND that</strong>
-#end
-
+#end
+
]]></source>
<p>
- The <em>#if()</em> directive will only evaluate to true
+ The <em>#if()</em> directive will only evaluate to true
if both <em>$foo</em>
and <em>$bar</em> are true. If <em>$foo</em> is false, the
expression will evaluate to false; <em>$bar</em> will not be
@@ -1120,9 +1131,9 @@
expression to be considered true. Consider the following example.
</p>
-<source><![CDATA[
-
-## logical OR
+<source><![CDATA[
+
+## logical OR
#if( $foo || $bar )
<strong>This OR That</strong>
@@ -1132,7 +1143,7 @@
<p>
If <em>$foo</em> is true, the Velocity Templating Engine has no
need to look at <em>$bar</em>; whether <em>$bar</em> is true or
- false, the expression will be true, and <strong>This OR That</strong>
+ false, the expression will be true, and <strong>This OR That</strong>
will be output. If <em>$foo</em> is false,
however, <em>$bar</em> must be checked. In this case, if
<em>$bar</em> is also false, the expression evaluates to false and
@@ -1140,30 +1151,30 @@
then the entire expression is true, and the output is
<strong>This OR That</strong>
</p>
-
- <p>
- With logical NOT operators, there is only one argument :
- </p>
-
-<source><![CDATA[
-
-##logical NOT
-
-#if( !$foo )
- <strong>NOT that</strong>
-#end
-
-]]></source>
-
- <p>
- Here, the if <em>$foo</em> is true, then <em>!$foo</em> evaluates to
- false, and there is no output. If <em>$foo</em> is false, then
- <em>!$foo</em> evaluates to true and <strong>NOT that</strong> will be
- output. Be careful not to confuse this with the <em>quiet reference $!foo</em>
- which is something altogether different.
- </p>
-
-
+
+ <p>
+ With logical NOT operators, there is only one argument :
+ </p>
+
+<source><![CDATA[
+
+##logical NOT
+
+#if( !$foo )
+ <strong>NOT that</strong>
+#end
+
+]]></source>
+
+ <p>
+ Here, the if <em>$foo</em> is true, then <em>!$foo</em> evaluates to
+ false, and there is no output. If <em>$foo</em> is false, then
+ <em>!$foo</em> evaluates to true and <strong>NOT that</strong> will be
+ output. Be careful not to confuse this with the <em>quiet reference $!foo</em>
+ which is something altogether different.
+ </p>
+
+
</section>
<section name="Loops">
1.79 +11 -1 jakarta-velocity/docs/user-guide.html
Index: user-guide.html
===================================================================
RCS file: /home/cvs/jakarta-velocity/docs/user-guide.html,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -r1.78 -r1.79
--- user-guide.html 21 Oct 2003 12:05:36 -0000 1.78
+++ user-guide.html 23 Oct 2003 13:50:07 -0000 1.79
@@ -1447,6 +1447,7 @@
<li>Method reference</li>
<li>Number literal</li>
<li>ArrayList</li>
+ <li>Map</li>
</ul>
</p>
<p>
@@ -1468,6 +1469,7 @@
#set( $monkey.Plan = $spindoctor.weave($web) ) ## method reference
#set( $monkey.Number = 123 ) ##number literal
#set( $monkey.Say = ["Not", $my, "fault"] ) ## ArrayList
+#set( $monkey.Map = ["bannana" : "good", "roast beef"
: "bad"]) ## Map
</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1"
height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
@@ -1479,11 +1481,19 @@
</table>
</div>
<p>
- NOTE: In the last example the elements defined with the
+ NOTE: For the ArrayList example the elements defined with the
[..] operator are accessible using the methods defined
in the ArrayList class. So, for example, you could access
the first element above using $monkey.Say.get(0).
</p>
+ <p>
+ Similarly, for the Map example, the elements defined within the
+ [..] operator are accessible using the methods defined
+ in the Map class. So, for example, you could access
+ the first element above using $monkey.Map.get("bannana") to return
+ a String 'good', or even $monkey.Map.bannana to return the
+ same value.
+ </p>
<p>
The RHS can also be a simple arithmetic expression:
</p>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]