Return-Path: Delivered-To: apmail-cocoon-cvs-archive@www.apache.org Received: (qmail 42870 invoked from network); 18 Nov 2005 04:31:05 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 18 Nov 2005 04:31:05 -0000 Received: (qmail 43767 invoked by uid 500); 18 Nov 2005 04:24:39 -0000 Delivered-To: apmail-cocoon-cvs-archive@cocoon.apache.org Received: (qmail 31022 invoked by uid 500); 18 Nov 2005 04:21:28 -0000 Mailing-List: contact cvs-help@cocoon.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@cocoon.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list cvs@cocoon.apache.org Received: (qmail 22206 invoked by uid 99); 18 Nov 2005 04:19:20 -0000 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Thu, 17 Nov 2005 20:16:39 -0800 Received: (qmail 7897 invoked by uid 65534); 18 Nov 2005 04:15:33 -0000 Message-ID: <20051118041533.7896.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r345438 [161/286] - in /cocoon/site/site/2.1: ./ developing/ developing/portal/ developing/portal/coplets/ developing/webapps/ developing/webapps/authentication/ faq/ howto/ installing/ plan/ plan/documentation/ plan/otherplanning/ plan/ove... Date: Fri, 18 Nov 2005 04:13:22 -0000 To: cvs@cocoon.apache.org From: crossley@apache.org X-Mailer: svnmailer-1.0.5 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Added: cocoon/site/site/2.1/userdocs/flow/velocity.html URL: http://svn.apache.org/viewcvs/cocoon/site/site/2.1/userdocs/flow/velocity.html?rev=345438&view=auto ============================================================================== --- cocoon/site/site/2.1/userdocs/flow/velocity.html (added) +++ cocoon/site/site/2.1/userdocs/flow/velocity.html Thu Nov 17 20:00:02 2005 @@ -0,0 +1,1319 @@ + + + + + + + +Advanced Control Flow - Velocity + + + + + + + + + +
+ + + +
+ + + + + + + + + + + + +
+
+
+
+ +
+ + +
+ +
+ +   +
+ + + + + +
+

Advanced Control Flow - Velocity

+ +

Velocity Generator

+
+

If called from a Flowscript, the Cocoon +Velocity +Generator provides access to the immediate properties of +the context object passed to +cocoon.sendPage and +cocoon.sendPageAndWait. In +addition, the current +WebContinuation is also +available as a variable named $continuation. You would typically access +its id:

+
  <form action="$continuation.id">
+
+

You can also reach previous continuations by using the getParent() +function:

+
  <form action="$continuation.getParent().id" >
+
+

In addition the following implicit objects are always available in the +Velocity context:

+
    + +
  • + +Request +$request : The current Cocoon request
  • + +
  • + +Response +$response : The Cocoon response associated with the current request +
  • + +
  • + +Session +$session : The Cocoon session associated with the current request
  • + +
  • + +Context +$context : The Cocoon context associated with the current request
  • + +
  • +org.apache.avalon.framework.parameters.Parameters +$parameters : Any parameters passed to the generator in the pipeline +
  • + +
+

Cocoon installs a Velocity introspector that makes it possible for you to +access JavaScript objects and arrays in your templates, as well as Java objects. +For example, assuming you had a Flowscript like this:

+
    sendPage("myTemplate.vm", {colors: ["red", "blue", "yellow"]});
+
+

You could do this in myTemplate.vm:

+
    <select name="colors">
+    #foreach ($color in $colors) 
+      <option value="$color">$color</option>
+    #end
+    </select>
+
+ +
+
+ +
 
+
+ + + Propchange: cocoon/site/site/2.1/userdocs/flow/velocity.html ------------------------------------------------------------------------------ svn:eol-style = native