cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jo...@apache.org
Subject cvs commit: cocoon-site/site/2.1/userdocs/flow api.html api.pdf jpath.html jpath.pdf jxforms.html jxforms.pdf jxtemplate.html jxtemplate.pdf sitemap.html sitemap.pdf using.html using.pdf velocity.html velocity.pdf views.html views.pdf woody.html woody.pdf continuations.html continuations.pdf how-does-it-work.html how-does-it-work.pdf index.html index.pdf
Date Sat, 19 Jul 2003 06:49:27 GMT
joerg       2003/07/18 23:49:26

  Modified:    site/2.1/userdocs/flow continuations.html continuations.pdf
                        how-does-it-work.html how-does-it-work.pdf
                        index.html index.pdf
  Added:       site/2.1/userdocs/flow api.html api.pdf jpath.html jpath.pdf
                        jxforms.html jxforms.pdf jxtemplate.html
                        jxtemplate.pdf sitemap.html sitemap.pdf using.html
                        using.pdf velocity.html velocity.pdf views.html
                        views.pdf woody.html woody.pdf
  Log:
  added/updated flow docu
  
  Revision  Changes    Path
  1.5       +363 -327  cocoon-site/site/2.1/userdocs/flow/continuations.html
  
  Index: continuations.html
  ===================================================================
  RCS file: /home/cvs/cocoon-site/site/2.1/userdocs/flow/continuations.html,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- continuations.html	21 May 2003 15:23:42 -0000	1.4
  +++ continuations.html	19 Jul 2003 06:49:25 -0000	1.5
  @@ -1,327 +1,363 @@
  -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  -<html>
  -<head>
  -<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  -<title>Advanced Control Flow</title>
  -<link type="text/css" href="../../skin/page.css" rel="stylesheet">
  -</head>
  -<body text="#000000" bgcolor="#FFFFFF">
  -<!--================= start Navigation Path ==================-->
  -<table summary="navigation path" width="100%" border="0" cellpadding="0" cellspacing="0">
  -<tr>
  -<td nowrap="nowrap" valign="middle" bgcolor="#CFDCED" height="20"><img height="1" width="5" alt="" border="0" src="../../skin/images/spacer.gif"><!--===== breadcrumb trail (javascript-generated) ====--><font size="2" face="Arial, Helvetica, Sans-serif"><script src="../../skin/breadcrumbs.js" language="JavaScript" type="text/javascript"></script></font></td>
  -</tr>
  -<tr>
  -<td bgcolor="#4C6C8F" height="2"><img height="2" width="2" alt="" border="0" src="../../skin/images/spacer.gif"></td>
  -</tr>
  -</table>
  -<!--================= end Navigation Path ==================-->
  -<!--================= start Banner ==================-->
  -<table summary="header with logos" width="100%" border="0" cellpadding="0" cellspacing="0">
  -<tr>
  -<!--================= start Group Logo ==================-->
  -<td bgcolor="#294563"><a href="http://xml.apache.org"><img border="0" class="logoImage" alt="Apache Cocoon" src="../../images/group-logo.gif"></a></td>
  -<!--================= end Group Logo ==================-->
  -<!--================= start Project Logo ==================--><td width="100%" align="center" bgcolor="#294563"><a href="http://cocoon.apache.org/"><img border="0" class="logoImage" alt="Apache Cocoon" src="../../images/project-logo.gif"></a></td>
  -<!--================= end Project Logo ==================-->
  -<!--================= start Search ==================--><td valign="top" rowspan="2" bgcolor="#294563">
  -<form target="_blank" action="http://www.google.com/search" method="get">
  -<table summary="search" border="0" cellspacing="0" cellpadding="0" bgcolor="#4C6C8F">
  -<tr>
  -<td colspan="3"><img height="10" width="1" alt="" src="../../skin/images/spacer.gif"></td>
  -</tr>
  -<tr>
  -<td><img height="1" width="1" alt="" src="../../skin/images/spacer.gif"></td><td nowrap="nowrap"><input value="cocoon.apache.org" name="sitesearch" type="hidden"><input size="15" name="q" id="query" type="text"><img height="1" width="5" alt="" src="../../skin/images/spacer.gif"><input name="Search" value="Search" type="submit">
  -<br>
  -<font face="Arial, Helvetica, Sans-serif" size="2" color="white">
  -                      the Apache Cocoon site
  -                      
  -                      
  -                    </font></td><td><img height="1" width="1" alt="" src="../../skin/images/spacer.gif"></td>
  -</tr>
  -<tr>
  -<td><img alt="" border="0" height="10" width="9" src="../../skin/images/search-left.gif"></td><td><img height="1" width="1" alt="" src="../../skin/images/spacer.gif"></td><td><img alt="" border="0" height="10" width="9" src="../../skin/images/search-right.gif"></td>
  -</tr>
  -</table>
  -</form>
  -</td>
  -<!--================= start Search ==================--><td bgcolor="#294563"><img height="10" width="10" alt="" src="../../skin/images/spacer.gif"></td>
  -</tr>
  -<tr>
  -<td valign="bottom" bgcolor="#294563" colspan="2">
  -<!--================= start Tabs ==================-->
  -<div class="tab">
  -<table summary="tab bar" border="0" cellpadding="0" cellspacing="0">
  -<tr>
  -<td width="8"><img alt="" height="8" width="8" src="../../skin/images/spacer.gif"></td><td valign="bottom">
  -<table summary="selected tab" style="height: 1.7em" border="0" cellpadding="0" cellspacing="0">
  -<tr>
  -<td valign="top" width="5" bgcolor="#4C6C8F"><img height="5" width="5" alt="" src="../../skin/images/tabSel-left.gif"></td><td valign="middle" bgcolor="#4C6C8F"><font color="#ffffff" size="2" face="Arial, Helvetica, Sans-serif"><b><a href="../../index.html"><font color="#000000">Home</font></a></b></font></td><td valign="top" width="5" bgcolor="#4C6C8F"><img height="5" width="5" alt="" src="../../skin/images/tabSel-right.gif"></td>
  -</tr>
  -</table>
  -</td>
  -</tr>
  -</table>
  -</div>
  -<!--================= end Tabs ==================-->
  -</td><td bgcolor="#294563"><img alt="" width="1" height="1" src="../../skin/images/spacer.gif"></td>
  -</tr>
  -<tr>
  -<td bgcolor="#4C6C8F" colspan="4"><img width="1" height="10" alt="" src="../../skin/images/spacer.gif"></td>
  -</tr>
  -</table>
  -<!--================= end Banner ==================-->
  -<!--================= start Menu, NavBar, Content ==================-->
  -<table summary="page content" bgcolor="#ffffff" width="100%" border="0" cellpadding="0" cellspacing="0">
  -<tr>
  -<td valign="top">
  -<table summary="menu" border="0" cellspacing="0" cellpadding="0">
  -<tr>
  -<!--================= start left top NavBar ==================-->
  -<td rowspan="3" valign="top">
  -<table summary="blue line" border="0" cellpadding="0" cellspacing="0">
  -<tr>
  -<td bgcolor="#294563"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif"></td>
  -</tr>
  -<tr>
  -<td bgcolor="#CFDCED"><font color="#4C6C8F" size="4" face="Arial, Helvetica, Sans-serif">&nbsp;</font></td>
  -</tr>
  -<tr>
  -<td bgcolor="#294563"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif"></td>
  -</tr>
  -</table>
  -</td>
  -<!--================= end left top NavBar ==================--><td bgcolor="#294563"><img width="1" height="1" alt="" src="../../skin/images/spacer.gif"></td><td valign="bottom" bgcolor="#4C6C8F"><img width="10" height="10" alt="" src="../../skin/images/spacer.gif"></td><td nowrap="nowrap" valign="top" bgcolor="#4C6C8F">
  -<!--================= start Menu items ==================-->
  -<div class="menu">
  -<ul>
  -<li>
  -<font color="#CFDCED">Navigation</font>
  -<ul>
  -    
  -<li>
  -<a href="../../index.html">Main</a>
  -</li>
  -    
  -<li>
  -<a href="../index.html">User Documentation</a>
  -</li>
  -  
  -</ul>
  -</li>
  -<li>
  -<font color="#CFDCED">Flowscript</font>
  -<ul>
  -    
  -<li>
  -<a href="index.html">Introduction</a>
  -</li>
  -    
  -<li>
  -<span class="sel"><font color="#ffcc00">Continuations</font></span>
  -</li>
  -    
  -<li>
  -<a href="how-does-it-work.html">How does it work?</a>
  -</li>
  -  
  -</ul>
  -</li>
  -</ul>
  -</div>
  -<!--================= end Menu items ==================-->
  -</td><td valign="bottom" bgcolor="#4C6C8F"><img width="10" height="10" alt="" src="../../skin/images/spacer.gif"></td><td bgcolor="#294563"><img width="1" height="1" alt="" src="../../skin/images/spacer.gif"></td>
  -</tr>
  -<tr>
  -<td valign="bottom" align="left" colspan="2" rowspan="2" bgcolor="#4C6C8F"><img height="10" width="10" border="0" alt="" src="../../skin/images/menu-left.gif"></td><td bgcolor="#4C6C8F"><img height="10" width="10" border="0" alt="" src="../../skin/images/spacer.gif"></td><td valign="bottom" align="right" colspan="2" rowspan="2" bgcolor="#4C6C8F"><img height="10" width="10" border="0" alt="" src="../../skin/images/menu-right.gif"></td>
  -</tr>
  -<tr>
  -<td height="1" bgcolor="#294563"><img width="1" height="1" alt="" src="../../skin/images/spacer.gif"></td>
  -</tr>
  -</table>
  -</td><td valign="top" width="100%">
  -<table summary="content" width="100%" border="0" cellpadding="0" cellspacing="0">
  -<!--================= start middle NavBar ==================-->
  -<tr>
  -<td colspan="4" bgcolor="#294563"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif"></td>
  -</tr>
  -<tr>
  -<td align="left" width="10" bgcolor="#CFDCED"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif"></td><td align="left" width="50%" bgcolor="#CFDCED"><font color="#4C6C8F" size="3" face="Arial, Helvetica, Sans-serif">
  -                &nbsp;
  -                
  -                </font><img width="10" height="8" alt="" src="../../skin/images/spacer.gif"></td><td align="right" width="50%" bgcolor="#CFDCED"><font color="#4C6C8F" size="3" face="Arial, Helvetica, Sans-serif">
  -                &nbsp;
  -                
  -                </font><img width="10" height="8" alt="" src="../../skin/images/spacer.gif"></td><td width="10" bgcolor="#CFDCED"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif"></td>
  -</tr>
  -<tr>
  -<td colspan="4" bgcolor="#294563"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif"></td>
  -</tr>
  -<!--================= end middle NavBar ==================-->
  -<!--================= start Content==================-->
  -<tr>
  -<td align="left" width="10"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif"></td><td align="left" width="100%">
  -<div class="content">
  -<table class="title" summary="">
  -<tr>
  -<td valign="middle">
  -<h1>Advanced Control Flow</h1>
  -</td><script Language="Javascript">
  -
  -function printit(){  
  -if (window.print) {
  -    window.print() ;  
  -} else {
  -    var WebBrowser = '<OBJECT CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" HEIGHT="0" WIDTH="0" ID="WebBrowser1"></OBJECT>';
  -document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
  -    WebBrowser1.ExecWB(6, 2);//Use a 1 vs. a 2 for a prompting dialog box    WebBrowser1.outerHTML = "";  
  -}
  -}
  -</script><script Language="Javascript">  
  -var NS = (navigator.appName == "Netscape");
  -var VERSION = parseInt(navigator.appVersion);
  -if (VERSION > 3) {
  -    document.write('<td nowrap="nowrap" width="40" align="center">');     
  -    document.write('  <a class="dida" href="javascript:printit()">');        
  -    document.write('    <img alt="Print this Page" src="../../skin/images/printer.gif" border="0"><br>');   
  -    document.write('  print</a>');   
  -    document.write('</td>');           
  -}
  -</script><td nowrap="nowrap" width="40" align="center"><a class="dida" href="continuations.pdf"><img alt="PDF" src="../../skin/images/pdfdoc.gif" border="0"><br>
  -          PDF</a></td>
  -</tr>
  -</table>
  -<p>
  -<font size="-2">by&nbsp;Ovidiu Predescu</font>
  -</p>
  -<ul class="minitoc">
  -<li>
  -<a href="#A+different+approach">A different approach</a>
  -<ul class="minitoc">
  -<li>
  -<a href="#What+are+continuations%3F">What are continuations?</a>
  -</li>
  -</ul>
  -</li>
  -</ul>
  -    
  -<a name="N10013"></a><a name="A+different+approach"></a>
  -<h3>A different approach</h3>
  -<div style="margin-left: 0 ; border: 2px">
  -<p>Web applications are essentially event-driven
  -      applications. Such applications have to react to events
  -      generated from the client browser, and they respond to these
  -      perhaps by changing their internal state and generating a
  -      response.</p>
  -<p>The result is that even a simple application that needs to
  -      collect some information from the user using more than one page,
  -      has to somehow maintain the input accumulated so far from the
  -      user. This input is a characteristic of the application
  -      state. Another characteristic of the application state is where
  -      the program processing is.</p>
  -<p>Let's look at an example. Suppose we want to write a very
  -      simple calculator, which collects the numbers to be added, as
  -      well as the operator, each in a separate page. It would be very
  -      nice if we could write something like this:</p>
  -<pre class="code">
  -function calculator()
  -{
  -  var a, b, operator;
  -
  -  sendPageAndWait("getA.html");
  -  a = request.getParameter("a");
  -
  -  sendPageAndWait("getB.html");
  -  b = request.getParameter("b");
  -
  -  sendPageAndWait("getOperator.html");
  -  operator = request.getParameter("op");
  -
  -  try {
  -    if (operator == "plus")
  -      sendPage("result.html", a + b);
  -    else if (operator == "minus")
  -      sendPage("result.html", a - b);
  -    else if (operator == "multiply")
  -      sendPage("result.html", a * b);
  -    else if (operator == "divide")
  -      sendPage("result.html", a / b);
  -    else
  -      sendResult("invalidOperator.html");
  -  }
  -  catch (Exception ex) {
  -    sendResult("error.html", "Operation failed: " + ex.toString();
  -  }
  -}
  -</pre>
  -<p>In this example, the <span class="codefrag">calculator</span> function is
  -      called to start the calculator application. We'd like the
  -      <span class="codefrag">sendPageAndWait</span> function to be a special function, that
  -      takes as arguments an HTML file to be sent as response, and some
  -      optional data that needs to be placed dynamically in it. We
  -      would like <span class="codefrag">sendPageAndWait</span> to send the response page and
  -      then block the executing thread, until the user clicks on a link
  -      in the response page, which sends a request back to the
  -      server. This request resumes the processing at the point it was
  -      left, right after the call to <span class="codefrag">sendPageAndWait</span>.</p>
  -<p>This approach looks very powerful, since the flow of pages
  -      within the application can be described as a normal
  -      program. Using this approach you no longer have to think of your
  -      Web application as a finite state machine, which transitions
  -      from one state to another, and in the process generates response
  -      pages.</p>
  -<p>A big disadvantage of the approach above is that we need to
  -      maintain a thread alive until the user hits the link on the
  -      response page. This is clearly very expensive!</p>
  -<p>It would be very nice if we can capture the state of the
  -      application, its stack of function calls, which includes local
  -      variables, the global variables and the program counter, and
  -      save them into an object. If this object would give us the
  -      ability to restart the processing from the point stored in it,
  -      this would be what we need!</p>
  -<a name="N1003E"></a><a name="What+are+continuations%3F"></a>
  -<h4>What are continuations?</h4>
  -<div style="margin-left: 0 ; border: 2px">
  -<p>A continuation is exactly the type of object that we need.
  -	Think of a continuation as an object that, for a given point
  -	in your program, contains a snapshot of the stack trace,
  -	including all the local variables, and the program
  -	counter. You can not only store these things in the
  -	continuation object, but also restore the execution of the
  -	program from a continuation object. This means that the stack
  -	trace and the program counter of the running program become
  -	the ones stored in a continuation.</p>
  -<p>Continuations are powerful concepts from the world of
  -	functional languages, like <a href="http://www.schemers.org/">Scheme</a>, but they are
  -	becoming popular in other languages as well.</p>
  -</div>
  -</div>
  -
  -  
  -</div>
  -</td><td width="10"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif"></td>
  -</tr>
  -<!--================= end Content==================-->
  -</table>
  -</td>
  -</tr>
  -</table>
  -<!--================= end Menu, NavBar, Content ==================-->
  -<!--================= start Footer ==================-->
  -<table summary="footer" cellspacing="0" cellpadding="0" width="100%" border="0">
  -<tr>
  -<td colspan="2" height="1" bgcolor="#4C6C8F"><img height="1" width="1" alt="" src="../../skin/images/spacer.gif"><a href="../../skin/images/label.gif"></a><a href="../../skin/images/page.gif"></a><a href="../../skin/images/chapter.gif"></a><a href="../../skin/images/chapter_open.gif"></a><a href="../../skin/images/current.gif"></a><a href="../..//favicon.ico"></a></td>
  -</tr>
  -<tr>
  -<td colspan="2" bgcolor="#CFDCED" class="copyright" align="center"><font size="2" face="Arial, Helvetica, Sans-Serif">Copyright &copy;
  -          1999-2003&nbsp;The Apache Software Foundation. All rights reserved.<script type="text/javascript" language="JavaScript"><!--
  -              document.write(" - "+"Last Published: " + document.lastModified);
  -            //  --></script></font></td>
  -</tr>
  -<tr>
  -<td colspan="2" align="left" bgcolor="#CFDCED" class="logos"></td>
  -</tr>
  -</table>
  -<!--================= end Footer ==================-->
  -</body>
  -</html>
  +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  +<html>
  +<head>
  +<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  +<title>Advanced Control Flow</title>
  +<link type="text/css" href="../../skin/page.css" rel="stylesheet">
  +</head>
  +<body text="#000000" bgcolor="#FFFFFF">
  +<!--================= start Navigation Path ==================-->
  +<table summary="navigation path" width="100%" border="0" cellpadding="0" cellspacing="0">
  +<tr>
  +<td nowrap="nowrap" valign="middle" bgcolor="#CFDCED" height="20"><img height="1" width="5" alt="" src="../../skin/images/spacer.gif" class="spacer"><!--===== breadcrumb trail (javascript-generated) ====--><font size="2" face="Arial, Helvetica, Sans-serif"><script src="../../skin/breadcrumbs.js" language="JavaScript" type="text/javascript"></script></font></td>
  +</tr>
  +<tr>
  +<td bgcolor="#4C6C8F" height="2"><img height="2" width="2" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  +</tr>
  +</table>
  +<!--================= end Navigation Path ==================-->
  +<!--================= start Banner ==================-->
  +<table summary="header with logos" width="100%" border="0" cellpadding="0" cellspacing="0">
  +<tr>
  +<!--================= start Group Logo ==================-->
  +<td bgcolor="#294563"><a href=""></a></td>
  +<!--================= end Group Logo ==================-->
  +<!--================= start Project Logo ==================--><td width="100%" align="center" bgcolor="#294563"><a href="http://cocoon.apache.org/"><img border="0" class="logoImage" alt="Apache Cocoon" src="../../images/project-logo.gif"></a></td>
  +<!--================= end Project Logo ==================-->
  +<!--================= start Search ==================--><td valign="top" rowspan="2" bgcolor="#294563">
  +<form target="_blank" action="http://www.google.com/search" method="get">
  +<table summary="search" border="0" cellspacing="0" cellpadding="0" bgcolor="#4C6C8F">
  +<tr>
  +<td colspan="3"><img height="10" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  +</tr>
  +<tr>
  +<td><img height="1" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td nowrap="nowrap"><input value="cocoon.apache.org" name="sitesearch" type="hidden"><input size="15" name="q" id="query" type="text"><img height="1" width="5" alt="" src="../../skin/images/spacer.gif" class="spacer"><input name="Search" value="Search" type="submit">
  +<br>
  +<font face="Arial, Helvetica, Sans-serif" size="2" color="white">
  +                      the Apache Cocoon site
  +                      
  +                      
  +                    </font></td><td><img height="1" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  +</tr>
  +<tr>
  +<td><img alt="" border="0" height="10" width="9" src="../../skin/images/search-left.gif"></td><td><img height="1" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td><img alt="" border="0" height="10" width="9" src="../../skin/images/search-right.gif"></td>
  +</tr>
  +</table>
  +</form>
  +</td>
  +<!--================= start Search ==================--><td bgcolor="#294563"><img height="10" width="10" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  +</tr>
  +<tr>
  +<td valign="bottom" bgcolor="#294563" colspan="2">
  +<!--================= start Tabs ==================-->
  +<div class="tab">
  +<table summary="tab bar" border="0" cellpadding="0" cellspacing="0">
  +<tr>
  +<td width="6"><img alt="" height="8" width="6" src="../../skin/images/spacer.gif"></td><td valign="bottom">
  +<table summary="selected tab" style="height: 1.8em" border="0" cellpadding="0" cellspacing="0">
  +<tr>
  +<td valign="top" width="5" bgcolor="#4C6C8F"><img height="5" width="5" alt="" src="../../skin/images/tabSel-left.gif"></td><td valign="middle" bgcolor="#4C6C8F"><font color="#ffffff" size="2" face="Arial, Helvetica, Sans-serif"><b><a href="../../index.html"><font color="#000000">Home</font></a></b></font></td><td valign="top" width="5" bgcolor="#4C6C8F"><img height="5" width="5" alt="" src="../../skin/images/tabSel-right.gif"></td>
  +</tr>
  +</table>
  +</td>
  +</tr>
  +</table>
  +</div>
  +<!--================= end Tabs ==================-->
  +</td><td bgcolor="#294563"><img alt="" width="1" height="1" src="../../skin/images/spacer.gif" class="spacer"></td>
  +</tr>
  +<tr>
  +<td bgcolor="#4C6C8F" colspan="4"><img width="1" height="10" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  +</tr>
  +</table>
  +<!--================= end Banner ==================-->
  +<!--================= start Menu, NavBar, Content ==================-->
  +<table summary="page content" bgcolor="#ffffff" width="100%" border="0" cellpadding="0" cellspacing="0">
  +<tr>
  +<td valign="top">
  +<table summary="menu" border="0" cellspacing="0" cellpadding="0">
  +<tr>
  +<!--================= start left top NavBar ==================-->
  +<td rowspan="3" valign="top">
  +<table summary="blue line" border="0" cellpadding="0" cellspacing="0">
  +<tr>
  +<td bgcolor="#294563"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  +</tr>
  +<tr>
  +<td bgcolor="#CFDCED"><font color="#4C6C8F" size="4" face="Arial, Helvetica, Sans-serif">&nbsp;</font></td>
  +</tr>
  +<tr>
  +<td bgcolor="#294563"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  +</tr>
  +</table>
  +</td>
  +<!--================= end left top NavBar ==================--><td bgcolor="#294563"><img width="1" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td valign="bottom" bgcolor="#4C6C8F"><img width="10" height="10" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td nowrap="nowrap" valign="top" bgcolor="#4C6C8F">
  +<!--================= start Menu items ==================-->
  +<div class="menu">
  +<ul>
  +<li>
  +<font color="#CFDCED">Navigation</font>
  +<ul>
  +    
  +<li>
  +<a href="../../index.html">Main</a>
  +</li>
  +    
  +<li>
  +<a href="../index.html">User Documentation</a>
  +</li>
  +  
  +</ul>
  +</li>
  +<li>
  +<font color="#CFDCED">Flowscript</font>
  +<ul>
  +    
  +<li>
  +<a href="index.html">Introduction</a>
  +</li>
  +    
  +<li>
  +<span class="sel"><font color="#ffcc00">Continuations</font></span>
  +</li>
  +    
  +<li>
  +<a href="how-does-it-work.html">How does it work?</a>
  +</li>
  +    
  +<li>
  +<a href="using.html">Usage</a>
  +</li>
  +    
  +<li>
  +<a href="sitemap.html">Sitemap</a>
  +</li>
  +    
  +<li>
  +<a href="api.html">JavaScript API</a>
  +</li>
  +    
  +<li>
  +<a href="views.html">Views</a>
  +</li>
  +    
  +<li>
  +<a href="jxtemplate.html">JXTemplate</a>
  +</li>
  +    
  +<li>
  +<a href="jpath.html">JPath</a>
  +</li>
  +    
  +<li>
  +<a href="velocity.html">Velocity</a>
  +</li> 
  +    
  +<li>
  +<a href="jxforms.html">JXForms</a>
  +</li>
  +    
  +<li>
  +<a href="woody.html">Woody</a>
  +</li>
  +  
  +</ul>
  +</li>
  +</ul>
  +</div>
  +<!--================= end Menu items ==================-->
  +</td><td valign="bottom" bgcolor="#4C6C8F"><img width="10" height="10" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td bgcolor="#294563"><img width="1" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  +</tr>
  +<tr>
  +<td valign="bottom" align="left" colspan="2" rowspan="2" bgcolor="#4C6C8F"><img height="10" width="10" border="0" alt="" src="../../skin/images/menu-left.gif"></td><td bgcolor="#4C6C8F"><img height="10" width="10" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td valign="bottom" align="right" colspan="2" rowspan="2" bgcolor="#4C6C8F"><img height="10" width="10" border="0" alt="" src="../../skin/images/menu-right.gif"></td>
  +</tr>
  +<tr>
  +<td height="1" bgcolor="#294563"><img width="1" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  +</tr>
  +</table>
  +</td><td valign="top" width="100%">
  +<table summary="content" width="100%" border="0" cellpadding="0" cellspacing="0">
  +<!--================= start middle NavBar ==================-->
  +<tr>
  +<td colspan="4" bgcolor="#294563"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  +</tr>
  +<tr>
  +<td align="left" width="10" bgcolor="#CFDCED"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td align="left" width="50%" bgcolor="#CFDCED"><font color="#4C6C8F" size="3" face="Arial, Helvetica, Sans-serif">
  +                &nbsp;
  +                
  +                </font><img width="10" height="8" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td align="right" width="50%" bgcolor="#CFDCED"><font color="#4C6C8F" size="3" face="Arial, Helvetica, Sans-serif">
  +                &nbsp;
  +                
  +                </font><img width="10" height="8" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td width="10" bgcolor="#CFDCED"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  +</tr>
  +<tr>
  +<td colspan="4" bgcolor="#294563"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  +</tr>
  +<!--================= end middle NavBar ==================-->
  +<!--================= start Content==================-->
  +<tr>
  +<td align="left" width="10"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td align="left" width="100%">
  +<div class="content">
  +<table class="title" summary="">
  +<tr>
  +<td valign="middle">
  +<h1>Advanced Control Flow</h1>
  +</td><script Language="Javascript">
  +
  +function printit(){  
  +if (window.print) {
  +    window.print() ;  
  +} else {
  +    var WebBrowser = '<OBJECT CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" HEIGHT="0" WIDTH="0" ID="WebBrowser1"></OBJECT>';
  +document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
  +    WebBrowser1.ExecWB(6, 2);//Use a 1 vs. a 2 for a prompting dialog box    WebBrowser1.outerHTML = "";  
  +}
  +}
  +</script><script Language="Javascript">  
  +var NS = (navigator.appName == "Netscape");
  +var VERSION = parseInt(navigator.appVersion);
  +if (VERSION > 3) {
  +    document.write('<td nowrap="nowrap" width="40" align="center">');     
  +    document.write('  <a class="dida" href="javascript:printit()">');        
  +    document.write('    <img alt="Print this Page" src="../../skin/images/printer.gif" class="skin"><br>');   
  +    document.write('  print</a>');   
  +    document.write('</td>');           
  +}
  +</script><td nowrap="nowrap" width="40" align="center"><a class="dida" href="continuations.pdf"><img alt="PDF" src="../../skin/images/pdfdoc.gif" class="skin"><br>
  +          PDF</a></td>
  +</tr>
  +</table>
  +<p>
  +<font size="-2">by&nbsp;Ovidiu Predescu</font>
  +</p>
  +<ul class="minitoc">
  +<li>
  +<a href="#A+different+approach">A different approach</a>
  +<ul class="minitoc">
  +<li>
  +<a href="#What+are+continuations%3F">What are continuations?</a>
  +</li>
  +</ul>
  +</li>
  +</ul>
  +    
  +<a name="N10013"></a><a name="A+different+approach"></a>
  +<h3>A different approach</h3>
  +<div style="margin-left: 0 ; border: 2px">
  +<p>Web applications are essentially event-driven
  +      applications. Such applications have to react to events
  +      generated from the client browser, and they respond to these
  +      perhaps by changing their internal state and generating a
  +      response.</p>
  +<p>The result is that even a simple application that needs to
  +      collect some information from the user using more than one page,
  +      has to somehow maintain the input accumulated so far from the
  +      user. This input is a characteristic of the application
  +      state. Another characteristic of the application state is where
  +      the program processing is.</p>
  +<p>Let's look at an example. Suppose we want to write a very
  +      simple calculator, which collects the numbers to be added, as
  +      well as the operator, each in a separate page. It would be very
  +      nice if we could write something like this:</p>
  +<pre class="code">
  +function calculator()
  +{
  +  var a, b, operator;
  +
  +  cocoon.sendPageAndWait("getA.html");
  +  a = cocoon.request.get("a");
  +
  +  cocoon.sendPageAndWait("getB.html");
  +  b = cocoon.request.get("b");
  +
  +  cocoon.sendPageAndWait("getOperator.html");
  +  operator = cocoon.request.get("op");
  +
  +  try {
  +    if (operator == "plus")
  +      cocoon.sendPage("result.html", {result: a + b});
  +    else if (operator == "minus")
  +      cocoon.sendPage("result.html", {result: a - b});
  +    else if (operator == "multiply")
  +      cocoon.sendPage("result.html", {result: a * b});
  +    else if (operator == "divide")
  +      cocoon.sendPage("result.html", {result: a / b});
  +    else
  +      cocoon.sendPage("invalidOperator.html", {operator: operator});
  +  }
  +  catch (exception) {
  +    cocoon.sendPage("error.html", {message: "Operation failed: " + exception.toString()});
  +  }
  +}
  +</pre>
  +<p>In this example, the <span class="codefrag">calculator</span> function is
  +      called to start the calculator application. We'd like the
  +      <span class="codefrag">sendPageAndWait</span> function to be a special function, that
  +      takes as arguments an HTML file to be sent as response, and some
  +      optional data that needs to be placed dynamically in it. We
  +      would like <span class="codefrag">sendPageAndWait</span> to send the response page and
  +      then block the executing thread, until the user clicks on a link
  +      in the response page, which sends a request back to the
  +      server. This request resumes the processing at the point it was
  +      left, right after the call to <span class="codefrag">sendPageAndWait</span>.</p>
  +<p>This approach looks very powerful, since the flow of pages
  +      within the application can be described as a normal
  +      program. Using this approach you no longer have to think of your
  +      Web application as a finite state machine, which transitions
  +      from one state to another, and in the process generates response
  +      pages.</p>
  +<p>A big disadvantage of the approach above is that we need to
  +      maintain a thread alive until the user hits the link on the
  +      response page. This is clearly very expensive!</p>
  +<p>It would be very nice if we could capture the state of the
  +      application, its stack of function calls, which includes local
  +      variables, the global variables and the program counter, and
  +      save them into an object. If this object would give us the
  +      ability to restart the processing from the point stored in it,
  +      this would be what we need!</p>
  +<a name="N1003E"></a><a name="What+are+continuations%3F"></a>
  +<h4>What are continuations?</h4>
  +<div style="margin-left: 0 ; border: 2px">
  +<p>A continuation is exactly the type of object that we need.
  +	Think of a continuation as an object that, for a given point
  +	in your program, contains a snapshot of the stack trace,
  +	including all the local variables, and the program
  +	counter. You can not only store these things in the
  +	continuation object, but also restore the execution of the
  +	program from a continuation object. This means that the stack
  +	trace and the program counter of the running program become
  +	the ones stored in a continuation.</p>
  +<p>Continuations are powerful concepts from the world of
  +	functional languages, like <a href="http://www.schemers.org/">Scheme</a>, but they are
  +	becoming popular in other languages as well.</p>
  +</div>
  +</div>
  +
  +  
  +</div>
  +</td><td width="10"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  +</tr>
  +<!--================= end Content==================-->
  +</table>
  +</td>
  +</tr>
  +</table>
  +<!--================= end Menu, NavBar, Content ==================-->
  +<!--================= start Footer ==================-->
  +<table summary="footer" cellspacing="0" cellpadding="0" width="100%" border="0">
  +<tr>
  +<td colspan="2" height="1" bgcolor="#4C6C8F"><img height="1" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"><a href="../../skin/images/label.gif"></a><a href="../../skin/images/page.gif"></a><a href="../../skin/images/chapter.gif"></a><a href="../../skin/images/chapter_open.gif"></a><a href="../../skin/images/current.gif"></a><a href="../..//favicon.ico"></a></td>
  +</tr>
  +<tr>
  +<td colspan="2" bgcolor="#CFDCED" class="copyright" align="center"><font size="2" face="Arial, Helvetica, Sans-Serif">Copyright &copy;
  +          1999-2003&nbsp;The Apache Software Foundation. All rights reserved.<script type="text/javascript" language="JavaScript"><!--
  +              document.write(" - "+"Last Published: " + document.lastModified);
  +            //  --></script></font></td>
  +</tr>
  +<tr>
  +<td colspan="2" align="left" bgcolor="#CFDCED" class="logos"></td>
  +</tr>
  +</table>
  +<!--================= end Footer ==================-->
  +</body>
  +</html>
  
  
  
  1.2       +46 -63    cocoon-site/site/2.1/userdocs/flow/continuations.pdf
  
  	<<Binary file>>
  
  
  1.5       +292 -256  cocoon-site/site/2.1/userdocs/flow/how-does-it-work.html
  
  Index: how-does-it-work.html
  ===================================================================
  RCS file: /home/cvs/cocoon-site/site/2.1/userdocs/flow/how-does-it-work.html,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- how-does-it-work.html	21 May 2003 15:23:42 -0000	1.4
  +++ how-does-it-work.html	19 Jul 2003 06:49:25 -0000	1.5
  @@ -1,256 +1,292 @@
  -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  -<html>
  -<head>
  -<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  -<title>Advanced Control Flow</title>
  -<link type="text/css" href="../../skin/page.css" rel="stylesheet">
  -</head>
  -<body text="#000000" bgcolor="#FFFFFF">
  -<!--================= start Navigation Path ==================-->
  -<table summary="navigation path" width="100%" border="0" cellpadding="0" cellspacing="0">
  -<tr>
  -<td nowrap="nowrap" valign="middle" bgcolor="#CFDCED" height="20"><img height="1" width="5" alt="" border="0" src="../../skin/images/spacer.gif"><!--===== breadcrumb trail (javascript-generated) ====--><font size="2" face="Arial, Helvetica, Sans-serif"><script src="../../skin/breadcrumbs.js" language="JavaScript" type="text/javascript"></script></font></td>
  -</tr>
  -<tr>
  -<td bgcolor="#4C6C8F" height="2"><img height="2" width="2" alt="" border="0" src="../../skin/images/spacer.gif"></td>
  -</tr>
  -</table>
  -<!--================= end Navigation Path ==================-->
  -<!--================= start Banner ==================-->
  -<table summary="header with logos" width="100%" border="0" cellpadding="0" cellspacing="0">
  -<tr>
  -<!--================= start Group Logo ==================-->
  -<td bgcolor="#294563"><a href="http://xml.apache.org"><img border="0" class="logoImage" alt="Apache Cocoon" src="../../images/group-logo.gif"></a></td>
  -<!--================= end Group Logo ==================-->
  -<!--================= start Project Logo ==================--><td width="100%" align="center" bgcolor="#294563"><a href="http://cocoon.apache.org/"><img border="0" class="logoImage" alt="Apache Cocoon" src="../../images/project-logo.gif"></a></td>
  -<!--================= end Project Logo ==================-->
  -<!--================= start Search ==================--><td valign="top" rowspan="2" bgcolor="#294563">
  -<form target="_blank" action="http://www.google.com/search" method="get">
  -<table summary="search" border="0" cellspacing="0" cellpadding="0" bgcolor="#4C6C8F">
  -<tr>
  -<td colspan="3"><img height="10" width="1" alt="" src="../../skin/images/spacer.gif"></td>
  -</tr>
  -<tr>
  -<td><img height="1" width="1" alt="" src="../../skin/images/spacer.gif"></td><td nowrap="nowrap"><input value="cocoon.apache.org" name="sitesearch" type="hidden"><input size="15" name="q" id="query" type="text"><img height="1" width="5" alt="" src="../../skin/images/spacer.gif"><input name="Search" value="Search" type="submit">
  -<br>
  -<font face="Arial, Helvetica, Sans-serif" size="2" color="white">
  -                      the Apache Cocoon site
  -                      
  -                      
  -                    </font></td><td><img height="1" width="1" alt="" src="../../skin/images/spacer.gif"></td>
  -</tr>
  -<tr>
  -<td><img alt="" border="0" height="10" width="9" src="../../skin/images/search-left.gif"></td><td><img height="1" width="1" alt="" src="../../skin/images/spacer.gif"></td><td><img alt="" border="0" height="10" width="9" src="../../skin/images/search-right.gif"></td>
  -</tr>
  -</table>
  -</form>
  -</td>
  -<!--================= start Search ==================--><td bgcolor="#294563"><img height="10" width="10" alt="" src="../../skin/images/spacer.gif"></td>
  -</tr>
  -<tr>
  -<td valign="bottom" bgcolor="#294563" colspan="2">
  -<!--================= start Tabs ==================-->
  -<div class="tab">
  -<table summary="tab bar" border="0" cellpadding="0" cellspacing="0">
  -<tr>
  -<td width="8"><img alt="" height="8" width="8" src="../../skin/images/spacer.gif"></td><td valign="bottom">
  -<table summary="selected tab" style="height: 1.7em" border="0" cellpadding="0" cellspacing="0">
  -<tr>
  -<td valign="top" width="5" bgcolor="#4C6C8F"><img height="5" width="5" alt="" src="../../skin/images/tabSel-left.gif"></td><td valign="middle" bgcolor="#4C6C8F"><font color="#ffffff" size="2" face="Arial, Helvetica, Sans-serif"><b><a href="../../index.html"><font color="#000000">Home</font></a></b></font></td><td valign="top" width="5" bgcolor="#4C6C8F"><img height="5" width="5" alt="" src="../../skin/images/tabSel-right.gif"></td>
  -</tr>
  -</table>
  -</td>
  -</tr>
  -</table>
  -</div>
  -<!--================= end Tabs ==================-->
  -</td><td bgcolor="#294563"><img alt="" width="1" height="1" src="../../skin/images/spacer.gif"></td>
  -</tr>
  -<tr>
  -<td bgcolor="#4C6C8F" colspan="4"><img width="1" height="10" alt="" src="../../skin/images/spacer.gif"></td>
  -</tr>
  -</table>
  -<!--================= end Banner ==================-->
  -<!--================= start Menu, NavBar, Content ==================-->
  -<table summary="page content" bgcolor="#ffffff" width="100%" border="0" cellpadding="0" cellspacing="0">
  -<tr>
  -<td valign="top">
  -<table summary="menu" border="0" cellspacing="0" cellpadding="0">
  -<tr>
  -<!--================= start left top NavBar ==================-->
  -<td rowspan="3" valign="top">
  -<table summary="blue line" border="0" cellpadding="0" cellspacing="0">
  -<tr>
  -<td bgcolor="#294563"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif"></td>
  -</tr>
  -<tr>
  -<td bgcolor="#CFDCED"><font color="#4C6C8F" size="4" face="Arial, Helvetica, Sans-serif">&nbsp;</font></td>
  -</tr>
  -<tr>
  -<td bgcolor="#294563"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif"></td>
  -</tr>
  -</table>
  -</td>
  -<!--================= end left top NavBar ==================--><td bgcolor="#294563"><img width="1" height="1" alt="" src="../../skin/images/spacer.gif"></td><td valign="bottom" bgcolor="#4C6C8F"><img width="10" height="10" alt="" src="../../skin/images/spacer.gif"></td><td nowrap="nowrap" valign="top" bgcolor="#4C6C8F">
  -<!--================= start Menu items ==================-->
  -<div class="menu">
  -<ul>
  -<li>
  -<font color="#CFDCED">Navigation</font>
  -<ul>
  -    
  -<li>
  -<a href="../../index.html">Main</a>
  -</li>
  -    
  -<li>
  -<a href="../index.html">User Documentation</a>
  -</li>
  -  
  -</ul>
  -</li>
  -<li>
  -<font color="#CFDCED">Flowscript</font>
  -<ul>
  -    
  -<li>
  -<a href="index.html">Introduction</a>
  -</li>
  -    
  -<li>
  -<a href="continuations.html">Continuations</a>
  -</li>
  -    
  -<li>
  -<span class="sel"><font color="#ffcc00">How does it work?</font></span>
  -</li>
  -  
  -</ul>
  -</li>
  -</ul>
  -</div>
  -<!--================= end Menu items ==================-->
  -</td><td valign="bottom" bgcolor="#4C6C8F"><img width="10" height="10" alt="" src="../../skin/images/spacer.gif"></td><td bgcolor="#294563"><img width="1" height="1" alt="" src="../../skin/images/spacer.gif"></td>
  -</tr>
  -<tr>
  -<td valign="bottom" align="left" colspan="2" rowspan="2" bgcolor="#4C6C8F"><img height="10" width="10" border="0" alt="" src="../../skin/images/menu-left.gif"></td><td bgcolor="#4C6C8F"><img height="10" width="10" border="0" alt="" src="../../skin/images/spacer.gif"></td><td valign="bottom" align="right" colspan="2" rowspan="2" bgcolor="#4C6C8F"><img height="10" width="10" border="0" alt="" src="../../skin/images/menu-right.gif"></td>
  -</tr>
  -<tr>
  -<td height="1" bgcolor="#294563"><img width="1" height="1" alt="" src="../../skin/images/spacer.gif"></td>
  -</tr>
  -</table>
  -</td><td valign="top" width="100%">
  -<table summary="content" width="100%" border="0" cellpadding="0" cellspacing="0">
  -<!--================= start middle NavBar ==================-->
  -<tr>
  -<td colspan="4" bgcolor="#294563"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif"></td>
  -</tr>
  -<tr>
  -<td align="left" width="10" bgcolor="#CFDCED"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif"></td><td align="left" width="50%" bgcolor="#CFDCED"><font color="#4C6C8F" size="3" face="Arial, Helvetica, Sans-serif">
  -                &nbsp;
  -                
  -                </font><img width="10" height="8" alt="" src="../../skin/images/spacer.gif"></td><td align="right" width="50%" bgcolor="#CFDCED"><font color="#4C6C8F" size="3" face="Arial, Helvetica, Sans-serif">
  -                &nbsp;
  -                
  -                </font><img width="10" height="8" alt="" src="../../skin/images/spacer.gif"></td><td width="10" bgcolor="#CFDCED"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif"></td>
  -</tr>
  -<tr>
  -<td colspan="4" bgcolor="#294563"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif"></td>
  -</tr>
  -<!--================= end middle NavBar ==================-->
  -<!--================= start Content==================-->
  -<tr>
  -<td align="left" width="10"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif"></td><td align="left" width="100%">
  -<div class="content">
  -<table class="title" summary="">
  -<tr>
  -<td valign="middle">
  -<h1>Advanced Control Flow</h1>
  -</td><script Language="Javascript">
  -
  -function printit(){  
  -if (window.print) {
  -    window.print() ;  
  -} else {
  -    var WebBrowser = '<OBJECT CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" HEIGHT="0" WIDTH="0" ID="WebBrowser1"></OBJECT>';
  -document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
  -    WebBrowser1.ExecWB(6, 2);//Use a 1 vs. a 2 for a prompting dialog box    WebBrowser1.outerHTML = "";  
  -}
  -}
  -</script><script Language="Javascript">  
  -var NS = (navigator.appName == "Netscape");
  -var VERSION = parseInt(navigator.appVersion);
  -if (VERSION > 3) {
  -    document.write('<td nowrap="nowrap" width="40" align="center">');     
  -    document.write('  <a class="dida" href="javascript:printit()">');        
  -    document.write('    <img alt="Print this Page" src="../../skin/images/printer.gif" border="0"><br>');   
  -    document.write('  print</a>');   
  -    document.write('</td>');           
  -}
  -</script><td nowrap="nowrap" width="40" align="center"><a class="dida" href="how-does-it-work.pdf"><img alt="PDF" src="../../skin/images/pdfdoc.gif" border="0"><br>
  -          PDF</a></td>
  -</tr>
  -</table>
  -<p>
  -<font size="-2">by&nbsp;Ovidiu Predescu</font>
  -</p>
  -<ul class="minitoc">
  -<li>
  -<a href="#Cocoon+and+continuations">Cocoon and continuations</a>
  -</li>
  -</ul>
  -    
  -<a name="N10013"></a><a name="Cocoon+and+continuations"></a>
  -<h3>Cocoon and continuations</h3>
  -<div style="margin-left: 0 ; border: 2px">
  -<p>With continuations in the language, you can essentially
  -	store the continuation of <span class="codefrag">sendPageAndWait</span> (think of all
  -	the stack trace, and the program counter), put it in a global
  -	hash table associated with an id. The id is then encoded in
  -	the <span class="codefrag">response.xml</span> page as an URL. When the user
  -	clicks on that URL, on the server side the associated
  -	continuation is resumed. Resuming the processing happens as if
  -	nothing was stopped, you get all the stack trace back, and all
  -	the local variables.</p>
  -<p>So instead of using beans to store things in session, you
  -	use normal variables in a program. Since each user has its own
  -	version of the program, all the local variables in the program
  -	are separate between users.</p>
  -<p>With this approach clicking the <em>Back</em> button in the
  -	browser is no longer a hassle to deal with for you as a
  -	server-side programmer. They will simply refer to past
  -	continuations objects, which have their own state of the local
  -	variables.</p>
  -<p>Since continuations are objects, you can also store them in
  -	a database, for really long-lived session, just like you do
  -	with session beans.</p>
  -</div>
  -
  -  
  -</div>
  -</td><td width="10"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif"></td>
  -</tr>
  -<!--================= end Content==================-->
  -</table>
  -</td>
  -</tr>
  -</table>
  -<!--================= end Menu, NavBar, Content ==================-->
  -<!--================= start Footer ==================-->
  -<table summary="footer" cellspacing="0" cellpadding="0" width="100%" border="0">
  -<tr>
  -<td colspan="2" height="1" bgcolor="#4C6C8F"><img height="1" width="1" alt="" src="../../skin/images/spacer.gif"><a href="../../skin/images/label.gif"></a><a href="../../skin/images/page.gif"></a><a href="../../skin/images/chapter.gif"></a><a href="../../skin/images/chapter_open.gif"></a><a href="../../skin/images/current.gif"></a><a href="../..//favicon.ico"></a></td>
  -</tr>
  -<tr>
  -<td colspan="2" bgcolor="#CFDCED" class="copyright" align="center"><font size="2" face="Arial, Helvetica, Sans-Serif">Copyright &copy;
  -          1999-2003&nbsp;The Apache Software Foundation. All rights reserved.<script type="text/javascript" language="JavaScript"><!--
  -              document.write(" - "+"Last Published: " + document.lastModified);
  -            //  --></script></font></td>
  -</tr>
  -<tr>
  -<td colspan="2" align="left" bgcolor="#CFDCED" class="logos"></td>
  -</tr>
  -</table>
  -<!--================= end Footer ==================-->
  -</body>
  -</html>
  +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  +<html>
  +<head>
  +<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  +<title>Advanced Control Flow</title>
  +<link type="text/css" href="../../skin/page.css" rel="stylesheet">
  +</head>
  +<body text="#000000" bgcolor="#FFFFFF">
  +<!--================= start Navigation Path ==================-->
  +<table summary="navigation path" width="100%" border="0" cellpadding="0" cellspacing="0">
  +<tr>
  +<td nowrap="nowrap" valign="middle" bgcolor="#CFDCED" height="20"><img height="1" width="5" alt="" src="../../skin/images/spacer.gif" class="spacer"><!--===== breadcrumb trail (javascript-generated) ====--><font size="2" face="Arial, Helvetica, Sans-serif"><script src="../../skin/breadcrumbs.js" language="JavaScript" type="text/javascript"></script></font></td>
  +</tr>
  +<tr>
  +<td bgcolor="#4C6C8F" height="2"><img height="2" width="2" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  +</tr>
  +</table>
  +<!--================= end Navigation Path ==================-->
  +<!--================= start Banner ==================-->
  +<table summary="header with logos" width="100%" border="0" cellpadding="0" cellspacing="0">
  +<tr>
  +<!--================= start Group Logo ==================-->
  +<td bgcolor="#294563"><a href=""></a></td>
  +<!--================= end Group Logo ==================-->
  +<!--================= start Project Logo ==================--><td width="100%" align="center" bgcolor="#294563"><a href="http://cocoon.apache.org/"><img border="0" class="logoImage" alt="Apache Cocoon" src="../../images/project-logo.gif"></a></td>
  +<!--================= end Project Logo ==================-->
  +<!--================= start Search ==================--><td valign="top" rowspan="2" bgcolor="#294563">
  +<form target="_blank" action="http://www.google.com/search" method="get">
  +<table summary="search" border="0" cellspacing="0" cellpadding="0" bgcolor="#4C6C8F">
  +<tr>
  +<td colspan="3"><img height="10" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  +</tr>
  +<tr>
  +<td><img height="1" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td nowrap="nowrap"><input value="cocoon.apache.org" name="sitesearch" type="hidden"><input size="15" name="q" id="query" type="text"><img height="1" width="5" alt="" src="../../skin/images/spacer.gif" class="spacer"><input name="Search" value="Search" type="submit">
  +<br>
  +<font face="Arial, Helvetica, Sans-serif" size="2" color="white">
  +                      the Apache Cocoon site
  +                      
  +                      
  +                    </font></td><td><img height="1" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  +</tr>
  +<tr>
  +<td><img alt="" border="0" height="10" width="9" src="../../skin/images/search-left.gif"></td><td><img height="1" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td><img alt="" border="0" height="10" width="9" src="../../skin/images/search-right.gif"></td>
  +</tr>
  +</table>
  +</form>
  +</td>
  +<!--================= start Search ==================--><td bgcolor="#294563"><img height="10" width="10" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  +</tr>
  +<tr>
  +<td valign="bottom" bgcolor="#294563" colspan="2">
  +<!--================= start Tabs ==================-->
  +<div class="tab">
  +<table summary="tab bar" border="0" cellpadding="0" cellspacing="0">
  +<tr>
  +<td width="6"><img alt="" height="8" width="6" src="../../skin/images/spacer.gif"></td><td valign="bottom">
  +<table summary="selected tab" style="height: 1.8em" border="0" cellpadding="0" cellspacing="0">
  +<tr>
  +<td valign="top" width="5" bgcolor="#4C6C8F"><img height="5" width="5" alt="" src="../../skin/images/tabSel-left.gif"></td><td valign="middle" bgcolor="#4C6C8F"><font color="#ffffff" size="2" face="Arial, Helvetica, Sans-serif"><b><a href="../../index.html"><font color="#000000">Home</font></a></b></font></td><td valign="top" width="5" bgcolor="#4C6C8F"><img height="5" width="5" alt="" src="../../skin/images/tabSel-right.gif"></td>
  +</tr>
  +</table>
  +</td>
  +</tr>
  +</table>
  +</div>
  +<!--================= end Tabs ==================-->
  +</td><td bgcolor="#294563"><img alt="" width="1" height="1" src="../../skin/images/spacer.gif" class="spacer"></td>
  +</tr>
  +<tr>
  +<td bgcolor="#4C6C8F" colspan="4"><img width="1" height="10" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  +</tr>
  +</table>
  +<!--================= end Banner ==================-->
  +<!--================= start Menu, NavBar, Content ==================-->
  +<table summary="page content" bgcolor="#ffffff" width="100%" border="0" cellpadding="0" cellspacing="0">
  +<tr>
  +<td valign="top">
  +<table summary="menu" border="0" cellspacing="0" cellpadding="0">
  +<tr>
  +<!--================= start left top NavBar ==================-->
  +<td rowspan="3" valign="top">
  +<table summary="blue line" border="0" cellpadding="0" cellspacing="0">
  +<tr>
  +<td bgcolor="#294563"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  +</tr>
  +<tr>
  +<td bgcolor="#CFDCED"><font color="#4C6C8F" size="4" face="Arial, Helvetica, Sans-serif">&nbsp;</font></td>
  +</tr>
  +<tr>
  +<td bgcolor="#294563"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  +</tr>
  +</table>
  +</td>
  +<!--================= end left top NavBar ==================--><td bgcolor="#294563"><img width="1" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td valign="bottom" bgcolor="#4C6C8F"><img width="10" height="10" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td nowrap="nowrap" valign="top" bgcolor="#4C6C8F">
  +<!--================= start Menu items ==================-->
  +<div class="menu">
  +<ul>
  +<li>
  +<font color="#CFDCED">Navigation</font>
  +<ul>
  +    
  +<li>
  +<a href="../../index.html">Main</a>
  +</li>
  +    
  +<li>
  +<a href="../index.html">User Documentation</a>
  +</li>
  +  
  +</ul>
  +</li>
  +<li>
  +<font color="#CFDCED">Flowscript</font>
  +<ul>
  +    
  +<li>
  +<a href="index.html">Introduction</a>
  +</li>
  +    
  +<li>
  +<a href="continuations.html">Continuations</a>
  +</li>
  +    
  +<li>
  +<span class="sel"><font color="#ffcc00">How does it work?</font></span>
  +</li>
  +    
  +<li>
  +<a href="using.html">Usage</a>
  +</li>
  +    
  +<li>
  +<a href="sitemap.html">Sitemap</a>
  +</li>
  +    
  +<li>
  +<a href="api.html">JavaScript API</a>
  +</li>
  +    
  +<li>
  +<a href="views.html">Views</a>
  +</li>
  +    
  +<li>
  +<a href="jxtemplate.html">JXTemplate</a>
  +</li>
  +    
  +<li>
  +<a href="jpath.html">JPath</a>
  +</li>
  +    
  +<li>
  +<a href="velocity.html">Velocity</a>
  +</li> 
  +    
  +<li>
  +<a href="jxforms.html">JXForms</a>
  +</li>
  +    
  +<li>
  +<a href="woody.html">Woody</a>
  +</li>
  +  
  +</ul>
  +</li>
  +</ul>
  +</div>
  +<!--================= end Menu items ==================-->
  +</td><td valign="bottom" bgcolor="#4C6C8F"><img width="10" height="10" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td bgcolor="#294563"><img width="1" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  +</tr>
  +<tr>
  +<td valign="bottom" align="left" colspan="2" rowspan="2" bgcolor="#4C6C8F"><img height="10" width="10" border="0" alt="" src="../../skin/images/menu-left.gif"></td><td bgcolor="#4C6C8F"><img height="10" width="10" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td valign="bottom" align="right" colspan="2" rowspan="2" bgcolor="#4C6C8F"><img height="10" width="10" border="0" alt="" src="../../skin/images/menu-right.gif"></td>
  +</tr>
  +<tr>
  +<td height="1" bgcolor="#294563"><img width="1" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  +</tr>
  +</table>
  +</td><td valign="top" width="100%">
  +<table summary="content" width="100%" border="0" cellpadding="0" cellspacing="0">
  +<!--================= start middle NavBar ==================-->
  +<tr>
  +<td colspan="4" bgcolor="#294563"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  +</tr>
  +<tr>
  +<td align="left" width="10" bgcolor="#CFDCED"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td align="left" width="50%" bgcolor="#CFDCED"><font color="#4C6C8F" size="3" face="Arial, Helvetica, Sans-serif">
  +                &nbsp;
  +                
  +                </font><img width="10" height="8" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td align="right" width="50%" bgcolor="#CFDCED"><font color="#4C6C8F" size="3" face="Arial, Helvetica, Sans-serif">
  +                &nbsp;
  +                
  +                </font><img width="10" height="8" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td width="10" bgcolor="#CFDCED"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  +</tr>
  +<tr>
  +<td colspan="4" bgcolor="#294563"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  +</tr>
  +<!--================= end middle NavBar ==================-->
  +<!--================= start Content==================-->
  +<tr>
  +<td align="left" width="10"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td align="left" width="100%">
  +<div class="content">
  +<table class="title" summary="">
  +<tr>
  +<td valign="middle">
  +<h1>Advanced Control Flow</h1>
  +</td><script Language="Javascript">
  +
  +function printit(){  
  +if (window.print) {
  +    window.print() ;  
  +} else {
  +    var WebBrowser = '<OBJECT CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" HEIGHT="0" WIDTH="0" ID="WebBrowser1"></OBJECT>';
  +document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
  +    WebBrowser1.ExecWB(6, 2);//Use a 1 vs. a 2 for a prompting dialog box    WebBrowser1.outerHTML = "";  
  +}
  +}
  +</script><script Language="Javascript">  
  +var NS = (navigator.appName == "Netscape");
  +var VERSION = parseInt(navigator.appVersion);
  +if (VERSION > 3) {
  +    document.write('<td nowrap="nowrap" width="40" align="center">');     
  +    document.write('  <a class="dida" href="javascript:printit()">');        
  +    document.write('    <img alt="Print this Page" src="../../skin/images/printer.gif" class="skin"><br>');   
  +    document.write('  print</a>');   
  +    document.write('</td>');           
  +}
  +</script><td nowrap="nowrap" width="40" align="center"><a class="dida" href="how-does-it-work.pdf"><img alt="PDF" src="../../skin/images/pdfdoc.gif" class="skin"><br>
  +          PDF</a></td>
  +</tr>
  +</table>
  +<p>
  +<font size="-2">by&nbsp;Ovidiu Predescu</font>
  +</p>
  +<ul class="minitoc">
  +<li>
  +<a href="#Cocoon+and+continuations">Cocoon and continuations</a>
  +</li>
  +</ul>
  +    
  +<a name="N10013"></a><a name="Cocoon+and+continuations"></a>
  +<h3>Cocoon and continuations</h3>
  +<div style="margin-left: 0 ; border: 2px">
  +<p>With continuations in the language, you can essentially
  +	store the continuation of <span class="codefrag">sendPageAndWait()</span> (think of all
  +	the stack trace, and the program counter), put it in a global
  +	hash table associated with an id. The id is then encoded in
  +	the <span class="codefrag">response.xml</span> page as an URL. When the user
  +	clicks on that URL, on the server side the associated
  +	continuation is resumed. Resuming the processing happens as if
  +	nothing was stopped, you get all the stack trace back, and all
  +	the local variables.</p>
  +<p>So instead of using beans to store things in session, you
  +	use normal variables in a program. Since each user has its own
  +	version of the program, all the local variables in the program
  +	are separate between users.</p>
  +<p>With this approach clicking the <em>Back</em> button in the
  +	browser is no longer a hassle to deal with for you as a
  +	server-side programmer. They will simply refer to past
  +	continuations objects, which have their own state of the local
  +	variables.</p>
  +<p>Since continuations are objects, you can also store them in
  +	a database, for really long-lived session, just like you do
  +	with session beans.</p>
  +</div>
  +
  +  
  +</div>
  +</td><td width="10"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  +</tr>
  +<!--================= end Content==================-->
  +</table>
  +</td>
  +</tr>
  +</table>
  +<!--================= end Menu, NavBar, Content ==================-->
  +<!--================= start Footer ==================-->
  +<table summary="footer" cellspacing="0" cellpadding="0" width="100%" border="0">
  +<tr>
  +<td colspan="2" height="1" bgcolor="#4C6C8F"><img height="1" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"><a href="../../skin/images/label.gif"></a><a href="../../skin/images/page.gif"></a><a href="../../skin/images/chapter.gif"></a><a href="../../skin/images/chapter_open.gif"></a><a href="../../skin/images/current.gif"></a><a href="../..//favicon.ico"></a></td>
  +</tr>
  +<tr>
  +<td colspan="2" bgcolor="#CFDCED" class="copyright" align="center"><font size="2" face="Arial, Helvetica, Sans-Serif">Copyright &copy;
  +          1999-2003&nbsp;The Apache Software Foundation. All rights reserved.<script type="text/javascript" language="JavaScript"><!--
  +              document.write(" - "+"Last Published: " + document.lastModified);
  +            //  --></script></font></td>
  +</tr>
  +<tr>
  +<td colspan="2" align="left" bgcolor="#CFDCED" class="logos"></td>
  +</tr>
  +</table>
  +<!--================= end Footer ==================-->
  +</body>
  +</html>
  
  
  
  1.2       +43 -60    cocoon-site/site/2.1/userdocs/flow/how-does-it-work.pdf
  
  	<<Binary file>>
  
  
  1.5       +299 -263  cocoon-site/site/2.1/userdocs/flow/index.html
  
  Index: index.html
  ===================================================================
  RCS file: /home/cvs/cocoon-site/site/2.1/userdocs/flow/index.html,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- index.html	21 May 2003 15:23:42 -0000	1.4
  +++ index.html	19 Jul 2003 06:49:25 -0000	1.5
  @@ -1,263 +1,299 @@
  -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  -<html>
  -<head>
  -<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  -<title>Apache Cocoon - Control Flow</title>
  -<link type="text/css" href="../../skin/page.css" rel="stylesheet">
  -</head>
  -<body text="#000000" bgcolor="#FFFFFF">
  -<!--================= start Navigation Path ==================-->
  -<table summary="navigation path" width="100%" border="0" cellpadding="0" cellspacing="0">
  -<tr>
  -<td nowrap="nowrap" valign="middle" bgcolor="#CFDCED" height="20"><img height="1" width="5" alt="" border="0" src="../../skin/images/spacer.gif"><!--===== breadcrumb trail (javascript-generated) ====--><font size="2" face="Arial, Helvetica, Sans-serif"><script src="../../skin/breadcrumbs.js" language="JavaScript" type="text/javascript"></script></font></td>
  -</tr>
  -<tr>
  -<td bgcolor="#4C6C8F" height="2"><img height="2" width="2" alt="" border="0" src="../../skin/images/spacer.gif"></td>
  -</tr>
  -</table>
  -<!--================= end Navigation Path ==================-->
  -<!--================= start Banner ==================-->
  -<table summary="header with logos" width="100%" border="0" cellpadding="0" cellspacing="0">
  -<tr>
  -<!--================= start Group Logo ==================-->
  -<td bgcolor="#294563"><a href="http://xml.apache.org"><img border="0" class="logoImage" alt="Apache Cocoon" src="../../images/group-logo.gif"></a></td>
  -<!--================= end Group Logo ==================-->
  -<!--================= start Project Logo ==================--><td width="100%" align="center" bgcolor="#294563"><a href="http://cocoon.apache.org/"><img border="0" class="logoImage" alt="Apache Cocoon" src="../../images/project-logo.gif"></a></td>
  -<!--================= end Project Logo ==================-->
  -<!--================= start Search ==================--><td valign="top" rowspan="2" bgcolor="#294563">
  -<form target="_blank" action="http://www.google.com/search" method="get">
  -<table summary="search" border="0" cellspacing="0" cellpadding="0" bgcolor="#4C6C8F">
  -<tr>
  -<td colspan="3"><img height="10" width="1" alt="" src="../../skin/images/spacer.gif"></td>
  -</tr>
  -<tr>
  -<td><img height="1" width="1" alt="" src="../../skin/images/spacer.gif"></td><td nowrap="nowrap"><input value="cocoon.apache.org" name="sitesearch" type="hidden"><input size="15" name="q" id="query" type="text"><img height="1" width="5" alt="" src="../../skin/images/spacer.gif"><input name="Search" value="Search" type="submit">
  -<br>
  -<font face="Arial, Helvetica, Sans-serif" size="2" color="white">
  -                      the Apache Cocoon site
  -                      
  -                      
  -                    </font></td><td><img height="1" width="1" alt="" src="../../skin/images/spacer.gif"></td>
  -</tr>
  -<tr>
  -<td><img alt="" border="0" height="10" width="9" src="../../skin/images/search-left.gif"></td><td><img height="1" width="1" alt="" src="../../skin/images/spacer.gif"></td><td><img alt="" border="0" height="10" width="9" src="../../skin/images/search-right.gif"></td>
  -</tr>
  -</table>
  -</form>
  -</td>
  -<!--================= start Search ==================--><td bgcolor="#294563"><img height="10" width="10" alt="" src="../../skin/images/spacer.gif"></td>
  -</tr>
  -<tr>
  -<td valign="bottom" bgcolor="#294563" colspan="2">
  -<!--================= start Tabs ==================-->
  -<div class="tab">
  -<table summary="tab bar" border="0" cellpadding="0" cellspacing="0">
  -<tr>
  -<td width="8"><img alt="" height="8" width="8" src="../../skin/images/spacer.gif"></td><td valign="bottom">
  -<table summary="selected tab" style="height: 1.7em" border="0" cellpadding="0" cellspacing="0">
  -<tr>
  -<td valign="top" width="5" bgcolor="#4C6C8F"><img height="5" width="5" alt="" src="../../skin/images/tabSel-left.gif"></td><td valign="middle" bgcolor="#4C6C8F"><font color="#ffffff" size="2" face="Arial, Helvetica, Sans-serif"><b><a href="../../index.html"><font color="#000000">Home</font></a></b></font></td><td valign="top" width="5" bgcolor="#4C6C8F"><img height="5" width="5" alt="" src="../../skin/images/tabSel-right.gif"></td>
  -</tr>
  -</table>
  -</td>
  -</tr>
  -</table>
  -</div>
  -<!--================= end Tabs ==================-->
  -</td><td bgcolor="#294563"><img alt="" width="1" height="1" src="../../skin/images/spacer.gif"></td>
  -</tr>
  -<tr>
  -<td bgcolor="#4C6C8F" colspan="4"><img width="1" height="10" alt="" src="../../skin/images/spacer.gif"></td>
  -</tr>
  -</table>
  -<!--================= end Banner ==================-->
  -<!--================= start Menu, NavBar, Content ==================-->
  -<table summary="page content" bgcolor="#ffffff" width="100%" border="0" cellpadding="0" cellspacing="0">
  -<tr>
  -<td valign="top">
  -<table summary="menu" border="0" cellspacing="0" cellpadding="0">
  -<tr>
  -<!--================= start left top NavBar ==================-->
  -<td rowspan="3" valign="top">
  -<table summary="blue line" border="0" cellpadding="0" cellspacing="0">
  -<tr>
  -<td bgcolor="#294563"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif"></td>
  -</tr>
  -<tr>
  -<td bgcolor="#CFDCED"><font color="#4C6C8F" size="4" face="Arial, Helvetica, Sans-serif">&nbsp;</font></td>
  -</tr>
  -<tr>
  -<td bgcolor="#294563"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif"></td>
  -</tr>
  -</table>
  -</td>
  -<!--================= end left top NavBar ==================--><td bgcolor="#294563"><img width="1" height="1" alt="" src="../../skin/images/spacer.gif"></td><td valign="bottom" bgcolor="#4C6C8F"><img width="10" height="10" alt="" src="../../skin/images/spacer.gif"></td><td nowrap="nowrap" valign="top" bgcolor="#4C6C8F">
  -<!--================= start Menu items ==================-->
  -<div class="menu">
  -<ul>
  -<li>
  -<font color="#CFDCED">Navigation</font>
  -<ul>
  -    
  -<li>
  -<a href="../../index.html">Main</a>
  -</li>
  -    
  -<li>
  -<a href="../index.html">User Documentation</a>
  -</li>
  -  
  -</ul>
  -</li>
  -<li>
  -<font color="#CFDCED">Flowscript</font>
  -<ul>
  -    
  -<li>
  -<span class="sel"><font color="#ffcc00">Introduction</font></span>
  -</li>
  -    
  -<li>
  -<a href="continuations.html">Continuations</a>
  -</li>
  -    
  -<li>
  -<a href="how-does-it-work.html">How does it work?</a>
  -</li>
  -  
  -</ul>
  -</li>
  -</ul>
  -</div>
  -<!--================= end Menu items ==================-->
  -</td><td valign="bottom" bgcolor="#4C6C8F"><img width="10" height="10" alt="" src="../../skin/images/spacer.gif"></td><td bgcolor="#294563"><img width="1" height="1" alt="" src="../../skin/images/spacer.gif"></td>
  -</tr>
  -<tr>
  -<td valign="bottom" align="left" colspan="2" rowspan="2" bgcolor="#4C6C8F"><img height="10" width="10" border="0" alt="" src="../../skin/images/menu-left.gif"></td><td bgcolor="#4C6C8F"><img height="10" width="10" border="0" alt="" src="../../skin/images/spacer.gif"></td><td valign="bottom" align="right" colspan="2" rowspan="2" bgcolor="#4C6C8F"><img height="10" width="10" border="0" alt="" src="../../skin/images/menu-right.gif"></td>
  -</tr>
  -<tr>
  -<td height="1" bgcolor="#294563"><img width="1" height="1" alt="" src="../../skin/images/spacer.gif"></td>
  -</tr>
  -</table>
  -</td><td valign="top" width="100%">
  -<table summary="content" width="100%" border="0" cellpadding="0" cellspacing="0">
  -<!--================= start middle NavBar ==================-->
  -<tr>
  -<td colspan="4" bgcolor="#294563"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif"></td>
  -</tr>
  -<tr>
  -<td align="left" width="10" bgcolor="#CFDCED"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif"></td><td align="left" width="50%" bgcolor="#CFDCED"><font color="#4C6C8F" size="3" face="Arial, Helvetica, Sans-serif">
  -                &nbsp;
  -                
  -                </font><img width="10" height="8" alt="" src="../../skin/images/spacer.gif"></td><td align="right" width="50%" bgcolor="#CFDCED"><font color="#4C6C8F" size="3" face="Arial, Helvetica, Sans-serif">
  -                &nbsp;
  -                
  -                </font><img width="10" height="8" alt="" src="../../skin/images/spacer.gif"></td><td width="10" bgcolor="#CFDCED"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif"></td>
  -</tr>
  -<tr>
  -<td colspan="4" bgcolor="#294563"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif"></td>
  -</tr>
  -<!--================= end middle NavBar ==================-->
  -<!--================= start Content==================-->
  -<tr>
  -<td align="left" width="10"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif"></td><td align="left" width="100%">
  -<div class="content">
  -<table class="title" summary="">
  -<tr>
  -<td valign="middle">
  -<h1>Apache Cocoon - Control Flow</h1>
  -</td><script Language="Javascript">
  -
  -function printit(){  
  -if (window.print) {
  -    window.print() ;  
  -} else {
  -    var WebBrowser = '<OBJECT CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" HEIGHT="0" WIDTH="0" ID="WebBrowser1"></OBJECT>';
  -document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
  -    WebBrowser1.ExecWB(6, 2);//Use a 1 vs. a 2 for a prompting dialog box    WebBrowser1.outerHTML = "";  
  -}
  -}
  -</script><script Language="Javascript">  
  -var NS = (navigator.appName == "Netscape");
  -var VERSION = parseInt(navigator.appVersion);
  -if (VERSION > 3) {
  -    document.write('<td nowrap="nowrap" width="40" align="center">');     
  -    document.write('  <a class="dida" href="javascript:printit()">');        
  -    document.write('    <img alt="Print this Page" src="../../skin/images/printer.gif" border="0"><br>');   
  -    document.write('  print</a>');   
  -    document.write('</td>');           
  -}
  -</script><td nowrap="nowrap" width="40" align="center"><a class="dida" href="index.pdf"><img alt="PDF" src="../../skin/images/pdfdoc.gif" border="0"><br>
  -          PDF</a></td>
  -</tr>
  -</table>
  -<p>
  -<font size="-2">by&nbsp;Ovidiu Predescu</font>
  -</p>
  -<ul class="minitoc">
  -<li>
  -<a href="#Control+flow">Control flow</a>
  -</li>
  -</ul>
  -    
  -<a name="N10013"></a><a name="Control+flow"></a>
  -<h3>Control flow</h3>
  -<div style="margin-left: 0 ; border: 2px">
  -<p>Cocoon has advanced control flow, the ability to describe the
  -      order of Web pages that have to be sent to the client, at any
  -      given point in time in an application.</p>
  -<p>Traditional Web applications try to model the control flow of
  -      a Web application by modeling the application as a finite state
  -      machine (FSM). In this model, the Web application is composed of
  -      multiple states, but the application can be only in one state at
  -      a time. Any request received by the application transitions it
  -      in a different state. During such a transition, the application
  -      may perform various side-effects, such as updating objects
  -      either in memory or in a database. Another important side-effect
  -      of such a transition is that a Web page is sent back to the
  -      client browser.</p>
  -<p>For simple Web applications, this model works fine. However,
  -      as the application grows, the number of states and transitions
  -      between them grows as well, and it becomes hard to visualize
  -      what's happening in the application.</p>
  -<p>Moreover, the interactions in some applications are more
  -      complex than a simple finite state machine. In such cases it's
  -      much easier to think and implement the application as a program,
  -      rather than a FSM.</p>
  -<p>By using a high level programming concept called
  -      <em>continuations</em>, Cocoon tries to solve this problem, and
  -      promises to allow the control flow in Web applications to be
  -      modeled as a normal program.</p>
  -</div>
  -  
  -</div>
  -</td><td width="10"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif"></td>
  -</tr>
  -<!--================= end Content==================-->
  -</table>
  -</td>
  -</tr>
  -</table>
  -<!--================= end Menu, NavBar, Content ==================-->
  -<!--================= start Footer ==================-->
  -<table summary="footer" cellspacing="0" cellpadding="0" width="100%" border="0">
  -<tr>
  -<td colspan="2" height="1" bgcolor="#4C6C8F"><img height="1" width="1" alt="" src="../../skin/images/spacer.gif"><a href="../../skin/images/label.gif"></a><a href="../../skin/images/page.gif"></a><a href="../../skin/images/chapter.gif"></a><a href="../../skin/images/chapter_open.gif"></a><a href="../../skin/images/current.gif"></a><a href="../..//favicon.ico"></a></td>
  -</tr>
  -<tr>
  -<td colspan="2" bgcolor="#CFDCED" class="copyright" align="center"><font size="2" face="Arial, Helvetica, Sans-Serif">Copyright &copy;
  -          1999-2003&nbsp;The Apache Software Foundation. All rights reserved.<script type="text/javascript" language="JavaScript"><!--
  -              document.write(" - "+"Last Published: " + document.lastModified);
  -            //  --></script></font></td>
  -</tr>
  -<tr>
  -<td colspan="2" align="left" bgcolor="#CFDCED" class="logos">
  -<div>
  -<a href="http://validator.w3.org/check/referer"><img width="88" height="31" alt="Valid HTML 4.01!" src="../../skin/images/valid-html401.png" class="logoImage" border="0"></a><a href="http://jigsaw.w3.org/css-validator/"><img width="88" height="31" alt="Valid CSS!" src="../../skin/images/vcss.png" class="logoImage" border="0"></a><img alt="" height="1" width="10" src="../../skin/images/spacer.gif"><a href="http://xml.apache.org/forrest/"><img border="0" alt="Built with Apache Forrest logo" src="../../images/built-with-forrest-button.png" width="88" height="31"><img height="1" width="5" alt="" border="0" src="../../skin/images/spacer.gif"></a>
  -</div>
  -</td>
  -</tr>
  -</table>
  -<!--================= end Footer ==================-->
  -</body>
  -</html>
  +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  +<html>
  +<head>
  +<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  +<title>Apache Cocoon - Control Flow</title>
  +<link type="text/css" href="../../skin/page.css" rel="stylesheet">
  +</head>
  +<body text="#000000" bgcolor="#FFFFFF">
  +<!--================= start Navigation Path ==================-->
  +<table summary="navigation path" width="100%" border="0" cellpadding="0" cellspacing="0">
  +<tr>
  +<td nowrap="nowrap" valign="middle" bgcolor="#CFDCED" height="20"><img height="1" width="5" alt="" src="../../skin/images/spacer.gif" class="spacer"><!--===== breadcrumb trail (javascript-generated) ====--><font size="2" face="Arial, Helvetica, Sans-serif"><script src="../../skin/breadcrumbs.js" language="JavaScript" type="text/javascript"></script></font></td>
  +</tr>
  +<tr>
  +<td bgcolor="#4C6C8F" height="2"><img height="2" width="2" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  +</tr>
  +</table>
  +<!--================= end Navigation Path ==================-->
  +<!--================= start Banner ==================-->
  +<table summary="header with logos" width="100%" border="0" cellpadding="0" cellspacing="0">
  +<tr>
  +<!--================= start Group Logo ==================-->
  +<td bgcolor="#294563"><a href=""></a></td>
  +<!--================= end Group Logo ==================-->
  +<!--================= start Project Logo ==================--><td width="100%" align="center" bgcolor="#294563"><a href="http://cocoon.apache.org/"><img border="0" class="logoImage" alt="Apache Cocoon" src="../../images/project-logo.gif"></a></td>
  +<!--================= end Project Logo ==================-->
  +<!--================= start Search ==================--><td valign="top" rowspan="2" bgcolor="#294563">
  +<form target="_blank" action="http://www.google.com/search" method="get">
  +<table summary="search" border="0" cellspacing="0" cellpadding="0" bgcolor="#4C6C8F">
  +<tr>
  +<td colspan="3"><img height="10" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  +</tr>
  +<tr>
  +<td><img height="1" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td nowrap="nowrap"><input value="cocoon.apache.org" name="sitesearch" type="hidden"><input size="15" name="q" id="query" type="text"><img height="1" width="5" alt="" src="../../skin/images/spacer.gif" class="spacer"><input name="Search" value="Search" type="submit">
  +<br>
  +<font face="Arial, Helvetica, Sans-serif" size="2" color="white">
  +                      the Apache Cocoon site
  +                      
  +                      
  +                    </font></td><td><img height="1" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  +</tr>
  +<tr>
  +<td><img alt="" border="0" height="10" width="9" src="../../skin/images/search-left.gif"></td><td><img height="1" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td><img alt="" border="0" height="10" width="9" src="../../skin/images/search-right.gif"></td>
  +</tr>
  +</table>
  +</form>
  +</td>
  +<!--================= start Search ==================--><td bgcolor="#294563"><img height="10" width="10" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  +</tr>
  +<tr>
  +<td valign="bottom" bgcolor="#294563" colspan="2">
  +<!--================= start Tabs ==================-->
  +<div class="tab">
  +<table summary="tab bar" border="0" cellpadding="0" cellspacing="0">
  +<tr>
  +<td width="6"><img alt="" height="8" width="6" src="../../skin/images/spacer.gif"></td><td valign="bottom">
  +<table summary="selected tab" style="height: 1.8em" border="0" cellpadding="0" cellspacing="0">
  +<tr>
  +<td valign="top" width="5" bgcolor="#4C6C8F"><img height="5" width="5" alt="" src="../../skin/images/tabSel-left.gif"></td><td valign="middle" bgcolor="#4C6C8F"><font color="#ffffff" size="2" face="Arial, Helvetica, Sans-serif"><b><a href="../../index.html"><font color="#000000">Home</font></a></b></font></td><td valign="top" width="5" bgcolor="#4C6C8F"><img height="5" width="5" alt="" src="../../skin/images/tabSel-right.gif"></td>
  +</tr>
  +</table>
  +</td>
  +</tr>
  +</table>
  +</div>
  +<!--================= end Tabs ==================-->
  +</td><td bgcolor="#294563"><img alt="" width="1" height="1" src="../../skin/images/spacer.gif" class="spacer"></td>
  +</tr>
  +<tr>
  +<td bgcolor="#4C6C8F" colspan="4"><img width="1" height="10" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  +</tr>
  +</table>
  +<!--================= end Banner ==================-->
  +<!--================= start Menu, NavBar, Content ==================-->
  +<table summary="page content" bgcolor="#ffffff" width="100%" border="0" cellpadding="0" cellspacing="0">
  +<tr>
  +<td valign="top">
  +<table summary="menu" border="0" cellspacing="0" cellpadding="0">
  +<tr>
  +<!--================= start left top NavBar ==================-->
  +<td rowspan="3" valign="top">
  +<table summary="blue line" border="0" cellpadding="0" cellspacing="0">
  +<tr>
  +<td bgcolor="#294563"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  +</tr>
  +<tr>
  +<td bgcolor="#CFDCED"><font color="#4C6C8F" size="4" face="Arial, Helvetica, Sans-serif">&nbsp;</font></td>
  +</tr>
  +<tr>
  +<td bgcolor="#294563"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  +</tr>
  +</table>
  +</td>
  +<!--================= end left top NavBar ==================--><td bgcolor="#294563"><img width="1" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td valign="bottom" bgcolor="#4C6C8F"><img width="10" height="10" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td nowrap="nowrap" valign="top" bgcolor="#4C6C8F">
  +<!--================= start Menu items ==================-->
  +<div class="menu">
  +<ul>
  +<li>
  +<font color="#CFDCED">Navigation</font>
  +<ul>
  +    
  +<li>
  +<a href="../../index.html">Main</a>
  +</li>
  +    
  +<li>
  +<a href="../index.html">User Documentation</a>
  +</li>
  +  
  +</ul>
  +</li>
  +<li>
  +<font color="#CFDCED">Flowscript</font>
  +<ul>
  +    
  +<li>
  +<span class="sel"><font color="#ffcc00">Introduction</font></span>
  +</li>
  +    
  +<li>
  +<a href="continuations.html">Continuations</a>
  +</li>
  +    
  +<li>
  +<a href="how-does-it-work.html">How does it work?</a>
  +</li>
  +    
  +<li>
  +<a href="using.html">Usage</a>
  +</li>
  +    
  +<li>
  +<a href="sitemap.html">Sitemap</a>
  +</li>
  +    
  +<li>
  +<a href="api.html">JavaScript API</a>
  +</li>
  +    
  +<li>
  +<a href="views.html">Views</a>
  +</li>
  +    
  +<li>
  +<a href="jxtemplate.html">JXTemplate</a>
  +</li>
  +    
  +<li>
  +<a href="jpath.html">JPath</a>
  +</li>
  +    
  +<li>
  +<a href="velocity.html">Velocity</a>
  +</li> 
  +    
  +<li>
  +<a href="jxforms.html">JXForms</a>
  +</li>
  +    
  +<li>
  +<a href="woody.html">Woody</a>
  +</li>
  +  
  +</ul>
  +</li>
  +</ul>
  +</div>
  +<!--================= end Menu items ==================-->
  +</td><td valign="bottom" bgcolor="#4C6C8F"><img width="10" height="10" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td bgcolor="#294563"><img width="1" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  +</tr>
  +<tr>
  +<td valign="bottom" align="left" colspan="2" rowspan="2" bgcolor="#4C6C8F"><img height="10" width="10" border="0" alt="" src="../../skin/images/menu-left.gif"></td><td bgcolor="#4C6C8F"><img height="10" width="10" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td valign="bottom" align="right" colspan="2" rowspan="2" bgcolor="#4C6C8F"><img height="10" width="10" border="0" alt="" src="../../skin/images/menu-right.gif"></td>
  +</tr>
  +<tr>
  +<td height="1" bgcolor="#294563"><img width="1" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  +</tr>
  +</table>
  +</td><td valign="top" width="100%">
  +<table summary="content" width="100%" border="0" cellpadding="0" cellspacing="0">
  +<!--================= start middle NavBar ==================-->
  +<tr>
  +<td colspan="4" bgcolor="#294563"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  +</tr>
  +<tr>
  +<td align="left" width="10" bgcolor="#CFDCED"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td align="left" width="50%" bgcolor="#CFDCED"><font color="#4C6C8F" size="3" face="Arial, Helvetica, Sans-serif">
  +                &nbsp;
  +                
  +                </font><img width="10" height="8" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td align="right" width="50%" bgcolor="#CFDCED"><font color="#4C6C8F" size="3" face="Arial, Helvetica, Sans-serif">
  +                &nbsp;
  +                
  +                </font><img width="10" height="8" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td width="10" bgcolor="#CFDCED"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  +</tr>
  +<tr>
  +<td colspan="4" bgcolor="#294563"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  +</tr>
  +<!--================= end middle NavBar ==================-->
  +<!--================= start Content==================-->
  +<tr>
  +<td align="left" width="10"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td align="left" width="100%">
  +<div class="content">
  +<table class="title" summary="">
  +<tr>
  +<td valign="middle">
  +<h1>Apache Cocoon - Control Flow</h1>
  +</td><script Language="Javascript">
  +
  +function printit(){  
  +if (window.print) {
  +    window.print() ;  
  +} else {
  +    var WebBrowser = '<OBJECT CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" HEIGHT="0" WIDTH="0" ID="WebBrowser1"></OBJECT>';
  +document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
  +    WebBrowser1.ExecWB(6, 2);//Use a 1 vs. a 2 for a prompting dialog box    WebBrowser1.outerHTML = "";  
  +}
  +}
  +</script><script Language="Javascript">  
  +var NS = (navigator.appName == "Netscape");
  +var VERSION = parseInt(navigator.appVersion);
  +if (VERSION > 3) {
  +    document.write('<td nowrap="nowrap" width="40" align="center">');     
  +    document.write('  <a class="dida" href="javascript:printit()">');        
  +    document.write('    <img alt="Print this Page" src="../../skin/images/printer.gif" class="skin"><br>');   
  +    document.write('  print</a>');   
  +    document.write('</td>');           
  +}
  +</script><td nowrap="nowrap" width="40" align="center"><a class="dida" href="index.pdf"><img alt="PDF" src="../../skin/images/pdfdoc.gif" class="skin"><br>
  +          PDF</a></td>
  +</tr>
  +</table>
  +<p>
  +<font size="-2">by&nbsp;Ovidiu Predescu</font>
  +</p>
  +<ul class="minitoc">
  +<li>
  +<a href="#Control+flow">Control flow</a>
  +</li>
  +</ul>
  +    
  +<a name="N10013"></a><a name="Control+flow"></a>
  +<h3>Control flow</h3>
  +<div style="margin-left: 0 ; border: 2px">
  +<p>Cocoon has advanced control flow, the ability to describe the
  +      order of Web pages that have to be sent to the client, at any
  +      given point in time in an application.</p>
  +<p>Traditional Web applications try to model the control flow of
  +      a Web application by modeling the application as a finite state
  +      machine (FSM). In this model, the Web application is composed of
  +      multiple states, but the application can be only in one state at
  +      a time. Any request received by the application transitions it
  +      into a different state. During such a transition, the application
  +      may perform various side-effects, such as updating objects
  +      either in memory or in a database. Another important side-effect
  +      of such a transition is that a Web page is sent back to the
  +      client browser.</p>
  +<p>For simple Web applications, this model works fine. However,
  +      as the application grows, the number of states and transitions
  +      between them grows as well, and it becomes hard to visualize
  +      what's happening in the application.</p>
  +<p>Moreover, the interactions in some applications are more
  +      complex than a simple finite state machine. In such cases it's
  +      much easier to think of and implement the application as a program,
  +      rather than a FSM.</p>
  +<p>By using a high level programming concept called
  +      <em>continuations</em>, Cocoon tries to solve this problem, and
  +      promises to allow the control flow in Web applications to be
  +      modeled as a normal program.</p>
  +</div>
  +  
  +</div>
  +</td><td width="10"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  +</tr>
  +<!--================= end Content==================-->
  +</table>
  +</td>
  +</tr>
  +</table>
  +<!--================= end Menu, NavBar, Content ==================-->
  +<!--================= start Footer ==================-->
  +<table summary="footer" cellspacing="0" cellpadding="0" width="100%" border="0">
  +<tr>
  +<td colspan="2" height="1" bgcolor="#4C6C8F"><img height="1" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"><a href="../../skin/images/label.gif"></a><a href="../../skin/images/page.gif"></a><a href="../../skin/images/chapter.gif"></a><a href="../../skin/images/chapter_open.gif"></a><a href="../../skin/images/current.gif"></a><a href="../..//favicon.ico"></a></td>
  +</tr>
  +<tr>
  +<td colspan="2" bgcolor="#CFDCED" class="copyright" align="center"><font size="2" face="Arial, Helvetica, Sans-Serif">Copyright &copy;
  +          1999-2003&nbsp;The Apache Software Foundation. All rights reserved.<script type="text/javascript" language="JavaScript"><!--
  +              document.write(" - "+"Last Published: " + document.lastModified);
  +            //  --></script></font></td>
  +</tr>
  +<tr>
  +<td colspan="2" align="left" bgcolor="#CFDCED" class="logos">
  +<div>
  +<a href="http://validator.w3.org/check/referer"><img width="88" height="31" alt="Valid HTML 4.01!" src="../../skin/images/valid-html401.png" class="logoImage"></a><a href="http://jigsaw.w3.org/css-validator/"><img width="88" height="31" alt="Valid CSS!" src="../../skin/images/vcss.png" class="logoImage"></a><img alt="" height="1" width="10" src="../../skin/images/spacer.gif"><a href="http://xml.apache.org/forrest/"><img border="0" alt="Built with Apache Forrest logo" src="../../images/built-with-forrest-button.png" width="88" height="31"><img height="1" width="5" alt="" src="../../skin/images/spacer.gif" class="spacer"></a>
  +</div>
  +</td>
  +</tr>
  +</table>
  +<!--================= end Footer ==================-->
  +</body>
  +</html>
  
  
  
  1.2       +39 -56    cocoon-site/site/2.1/userdocs/flow/index.pdf
  
  	<<Binary file>>
  
  
  1.1                  cocoon-site/site/2.1/userdocs/flow/api.html
  
  Index: api.html
  ===================================================================
  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  <html>
  <head>
  <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  <title>Advanced Control Flow</title>
  <link type="text/css" href="../../skin/page.css" rel="stylesheet">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
  <!--================= start Navigation Path ==================-->
  <table summary="navigation path" width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td nowrap="nowrap" valign="middle" bgcolor="#CFDCED" height="20"><img height="1" width="5" alt="" src="../../skin/images/spacer.gif" class="spacer"><!--===== breadcrumb trail (javascript-generated) ====--><font size="2" face="Arial, Helvetica, Sans-serif"><script src="../../skin/breadcrumbs.js" language="JavaScript" type="text/javascript"></script></font></td>
  </tr>
  <tr>
  <td bgcolor="#4C6C8F" height="2"><img height="2" width="2" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  </table>
  <!--================= end Navigation Path ==================-->
  <!--================= start Banner ==================-->
  <table summary="header with logos" width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <!--================= start Group Logo ==================-->
  <td bgcolor="#294563"><a href=""></a></td>
  <!--================= end Group Logo ==================-->
  <!--================= start Project Logo ==================--><td width="100%" align="center" bgcolor="#294563"><a href="http://cocoon.apache.org/"><img border="0" class="logoImage" alt="Apache Cocoon" src="../../images/project-logo.gif"></a></td>
  <!--================= end Project Logo ==================-->
  <!--================= start Search ==================--><td valign="top" rowspan="2" bgcolor="#294563">
  <form target="_blank" action="http://www.google.com/search" method="get">
  <table summary="search" border="0" cellspacing="0" cellpadding="0" bgcolor="#4C6C8F">
  <tr>
  <td colspan="3"><img height="10" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td><img height="1" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td nowrap="nowrap"><input value="cocoon.apache.org" name="sitesearch" type="hidden"><input size="15" name="q" id="query" type="text"><img height="1" width="5" alt="" src="../../skin/images/spacer.gif" class="spacer"><input name="Search" value="Search" type="submit">
  <br>
  <font face="Arial, Helvetica, Sans-serif" size="2" color="white">
                        the Apache Cocoon site
                        
                        
                      </font></td><td><img height="1" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td><img alt="" border="0" height="10" width="9" src="../../skin/images/search-left.gif"></td><td><img height="1" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td><img alt="" border="0" height="10" width="9" src="../../skin/images/search-right.gif"></td>
  </tr>
  </table>
  </form>
  </td>
  <!--================= start Search ==================--><td bgcolor="#294563"><img height="10" width="10" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td valign="bottom" bgcolor="#294563" colspan="2">
  <!--================= start Tabs ==================-->
  <div class="tab">
  <table summary="tab bar" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td width="6"><img alt="" height="8" width="6" src="../../skin/images/spacer.gif"></td><td valign="bottom">
  <table summary="selected tab" style="height: 1.8em" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td valign="top" width="5" bgcolor="#4C6C8F"><img height="5" width="5" alt="" src="../../skin/images/tabSel-left.gif"></td><td valign="middle" bgcolor="#4C6C8F"><font color="#ffffff" size="2" face="Arial, Helvetica, Sans-serif"><b><a href="../../index.html"><font color="#000000">Home</font></a></b></font></td><td valign="top" width="5" bgcolor="#4C6C8F"><img height="5" width="5" alt="" src="../../skin/images/tabSel-right.gif"></td>
  </tr>
  </table>
  </td>
  </tr>
  </table>
  </div>
  <!--================= end Tabs ==================-->
  </td><td bgcolor="#294563"><img alt="" width="1" height="1" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td bgcolor="#4C6C8F" colspan="4"><img width="1" height="10" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  </table>
  <!--================= end Banner ==================-->
  <!--================= start Menu, NavBar, Content ==================-->
  <table summary="page content" bgcolor="#ffffff" width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td valign="top">
  <table summary="menu" border="0" cellspacing="0" cellpadding="0">
  <tr>
  <!--================= start left top NavBar ==================-->
  <td rowspan="3" valign="top">
  <table summary="blue line" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td bgcolor="#294563"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td bgcolor="#CFDCED"><font color="#4C6C8F" size="4" face="Arial, Helvetica, Sans-serif">&nbsp;</font></td>
  </tr>
  <tr>
  <td bgcolor="#294563"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  </table>
  </td>
  <!--================= end left top NavBar ==================--><td bgcolor="#294563"><img width="1" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td valign="bottom" bgcolor="#4C6C8F"><img width="10" height="10" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td nowrap="nowrap" valign="top" bgcolor="#4C6C8F">
  <!--================= start Menu items ==================-->
  <div class="menu">
  <ul>
  <li>
  <font color="#CFDCED">Navigation</font>
  <ul>
      
  <li>
  <a href="../../index.html">Main</a>
  </li>
      
  <li>
  <a href="../index.html">User Documentation</a>
  </li>
    
  </ul>
  </li>
  <li>
  <font color="#CFDCED">Flowscript</font>
  <ul>
      
  <li>
  <a href="index.html">Introduction</a>
  </li>
      
  <li>
  <a href="continuations.html">Continuations</a>
  </li>
      
  <li>
  <a href="how-does-it-work.html">How does it work?</a>
  </li>
      
  <li>
  <a href="using.html">Usage</a>
  </li>
      
  <li>
  <a href="sitemap.html">Sitemap</a>
  </li>
      
  <li>
  <span class="sel"><font color="#ffcc00">JavaScript API</font></span>
  </li>
      
  <li>
  <a href="views.html">Views</a>
  </li>
      
  <li>
  <a href="jxtemplate.html">JXTemplate</a>
  </li>
      
  <li>
  <a href="jpath.html">JPath</a>
  </li>
      
  <li>
  <a href="velocity.html">Velocity</a>
  </li> 
      
  <li>
  <a href="jxforms.html">JXForms</a>
  </li>
      
  <li>
  <a href="woody.html">Woody</a>
  </li>
    
  </ul>
  </li>
  </ul>
  </div>
  <!--================= end Menu items ==================-->
  </td><td valign="bottom" bgcolor="#4C6C8F"><img width="10" height="10" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td bgcolor="#294563"><img width="1" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td valign="bottom" align="left" colspan="2" rowspan="2" bgcolor="#4C6C8F"><img height="10" width="10" border="0" alt="" src="../../skin/images/menu-left.gif"></td><td bgcolor="#4C6C8F"><img height="10" width="10" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td valign="bottom" align="right" colspan="2" rowspan="2" bgcolor="#4C6C8F"><img height="10" width="10" border="0" alt="" src="../../skin/images/menu-right.gif"></td>
  </tr>
  <tr>
  <td height="1" bgcolor="#294563"><img width="1" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  </table>
  </td><td valign="top" width="100%">
  <table summary="content" width="100%" border="0" cellpadding="0" cellspacing="0">
  <!--================= start middle NavBar ==================-->
  <tr>
  <td colspan="4" bgcolor="#294563"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td align="left" width="10" bgcolor="#CFDCED"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td align="left" width="50%" bgcolor="#CFDCED"><font color="#4C6C8F" size="3" face="Arial, Helvetica, Sans-serif">
                  &nbsp;
                  
                  </font><img width="10" height="8" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td align="right" width="50%" bgcolor="#CFDCED"><font color="#4C6C8F" size="3" face="Arial, Helvetica, Sans-serif">
                  &nbsp;
                  
                  </font><img width="10" height="8" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td width="10" bgcolor="#CFDCED"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td colspan="4" bgcolor="#294563"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <!--================= end middle NavBar ==================-->
  <!--================= start Content==================-->
  <tr>
  <td align="left" width="10"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td align="left" width="100%">
  <div class="content">
  <table class="title" summary="">
  <tr>
  <td valign="middle">
  <h1>Advanced Control Flow</h1>
  </td><script Language="Javascript">
  
  function printit(){  
  if (window.print) {
      window.print() ;  
  } else {
      var WebBrowser = '<OBJECT CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" HEIGHT="0" WIDTH="0" ID="WebBrowser1"></OBJECT>';
  document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
      WebBrowser1.ExecWB(6, 2);//Use a 1 vs. a 2 for a prompting dialog box    WebBrowser1.outerHTML = "";  
  }
  }
  </script><script Language="Javascript">  
  var NS = (navigator.appName == "Netscape");
  var VERSION = parseInt(navigator.appVersion);
  if (VERSION > 3) {
      document.write('<td nowrap="nowrap" width="40" align="center">');     
      document.write('  <a class="dida" href="javascript:printit()">');        
      document.write('    <img alt="Print this Page" src="../../skin/images/printer.gif" class="skin"><br>');   
      document.write('  print</a>');   
      document.write('</td>');           
  }
  </script><td nowrap="nowrap" width="40" align="center"><a class="dida" href="api.pdf"><img alt="PDF" src="../../skin/images/pdfdoc.gif" class="skin"><br>
            PDF</a></td>
  </tr>
  </table>
  <p>
  <font size="-2">by&nbsp;Ovidiu Predescu,&nbsp;Christopher Oliver</font>
  </p>
  <ul class="minitoc">
  <li>
  <a href="#JavaScript+API">JavaScript API</a>
  </li>
  <li>
  <a href="#Calling+Java+from+JavaScript">Calling Java from JavaScript</a>
  </li>
  <li>
  <a href="#Flow+Object+Model">Flow Object Model</a>
  <ul class="minitoc">
  <li>
  <a href="#Cocoon+Object">Cocoon Object</a>
  </li>
  <li>
  <a href="#Request+Object">Request Object</a>
  </li>
  <li>
  <a href="#Response+Object">Response Object</a>
  </li>
  <li>
  <a href="#Session+Object">Session Object</a>
  </li>
  <li>
  <a href="#Context+Object">Context Object</a>
  </li>
  <li>
  <a href="#Cookie+Object">Cookie Object</a>
  </li>
  <li>
  <a href="#Log+Object">Log Object</a>
  </li>
  <li>
  <a href="#WebContinuation-N1070D">WebContinuation</a>
  </li>
  </ul>
  </li>
  </ul>
      
  <a name="N10017"></a><a name="JavaScript+API"></a>
  <h3>JavaScript API</h3>
  <div style="margin-left: 0 ; border: 2px">
  <p>Cocoon provides a JavaScript API to manage control flow based on an
          <a href="http://cvs.cocoondev.org/cgi-bin/viewcvs.cgi/?cvsroot=rhino">extended</a>
          version of <a href="http://www.mozilla.org/rhino">Mozilla Rhino</a> that supports continuations.</p>
  </div>
      
  <a name="N10028"></a><a name="Calling+Java+from+JavaScript"></a>
  <h3>Calling Java from JavaScript</h3>
  <div style="margin-left: 0 ; border: 2px">
  <p>
      You can easily call any Java code from your Flowscripts, for example:
      </p>
  <pre class="code">
      var map = new java.util.HashMap();
      map.put("foo", "bar");
      </pre>
  <p>Classes in packages under <span class="codefrag">java</span> are accessible directly in your scripts.</p>
  <p>Note that classes under <span class="codefrag">java.lang</span> are not automatically imported, however:</p>
  <pre class="code">var n = new java.lang.Integer(3);</pre>
  <p>All other java packages and classes are accessible under the property <span class="codefrag">Packages</span>:</p>
  <pre class="code">var tree = new Packages.javax.swing.JTree();</pre>
  <p>You can get the effect of Java imports using the <span class="codefrag">importPackage()</span> and <span class="codefrag">importClass()</span> functions:</p>
  <table class="ForrestTable" cellspacing="1" cellpadding="4">
       
  <tr>
         
  <td colspan="1" rowspan="1">
         In Java:
         </td>
         <td colspan="1" rowspan="1">
         In JavaScript:
         </td>
       
  </tr>
       
  <tr>
         
  <td colspan="1" rowspan="1">
         import foo.*;
         </td>
         <td colspan="1" rowspan="1">
         importPackage(Packages.foo);
         </td>
       
  </tr>
       
  <tr>
         
  <td colspan="1" rowspan="1">
         import foo.Bar;
         </td>
         <td colspan="1" rowspan="1">
         importClass(Packages.foo.Bar);
         </td>
       
  </tr>
      
  </table>
  <p>
        If your Java classes have getters and setters you can access them as properties in JavaScript:</p>
  <pre class="code">
                var d = new java.util.Date();
                d.year = 2003;    // same effect as d.setYear(2003);
        </pre>
  </div>
      
  <a name="N1008D"></a><a name="Flow+Object+Model"></a>
  <h3>Flow Object Model</h3>
  <div style="margin-left: 0 ; border: 2px">
  <p>Cocoon provides a set of system objects for use by Flowscripts. We call this set of objects the Flow Object Model (<em>FOM</em>).
        The Flow Object Model contains following objects:</p>
  <ul>
        
  <li>
  <a href="#cocoon">Cocoon</a>
  </li>
        
  <li>
  <a href="#request">Request</a>
  </li>
        
  <li>
  <a href="#response">Response</a>
  </li>
        
  <li>
  <a href="#session">Session</a>
  </li>
        
  <li>
  <a href="#context">Context</a>
  </li>
        
  <li>
  <a href="#cookie">Cookie</a>
  </li>
        
  <li>
  <a href="#log">Log</a>
  </li>
        
  <li>
  <a href="#WebContinuation">WebContinuation</a>
  </li>
      
  </ul>
  <a name="N100C3"></a><a name="Cocoon+Object"></a>
  <h4>Cocoon Object</h4>
  <div style="margin-left: 0 ; border: 2px">
  <a name="cocoon"></a>
  <p>The <span class="codefrag">Cocoon</span> object represents the current Cocoon Sitemap. This is the entry point into the FOM. There is one instance of <span class="codefrag">Cocoon</span> which you may access in your scripts as the global variable <span class="codefrag">cocoon</span>, for example like this:</p>
  <pre class="code">
           var value = cocoon.request.getAttribute("blah");
      </pre>
  <p>
       The <span class="codefrag">Cocoon</span> object supports the following properties and functions:
      </p>
  <a name="N100E1"></a><a name="request-N100DC"></a>
  <h5>request</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>The current Cocoon request:</p>
  <p>
      
  <em>Property</em> [<a href="#request">Request</a>] request
      </p>
  </div>
  <a name="N100F4"></a><a name="response-N100EF"></a>
  <h5>response</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>The current Cocoon response:</p>
  <p>
      
  <em>Property</em> [<a href="#response">Response</a>] response
      </p>
  </div>
  <a name="N10107"></a><a name="session-N10102"></a>
  <h5>session</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>The current Cocoon session:</p>
  <p>
      
  <em>Property</em> [<a href="#session">Session</a>] session
      </p>
  </div>
  <a name="N1011A"></a><a name="context-N10115"></a>
  <h5>context</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>The current Cocoon application context:</p>
  <p>
      
  <em>Property</em> [<a href="#context">Context</a>] context
      </p>
  </div>
  <a name="N1012D"></a><a name="log-N10128"></a>
  <h5>log</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>A reference to the current logger:</p>
  <p>
      
  <em>Property</em> [<a href="#log">Log</a>] log
      </p>
  </div>
  <a name="N10140"></a><a name="parameters"></a>
  <h5>parameters</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>Any parameters passed to the script by the Cocoon Sitemap</p>
  <p>
      
  <em>Property</em> <span class="codefrag">[Object] parameters</span>
      
  </p>
  </div>
  <a name="N10152"></a><a name="sendPage-N1014D"></a>
  <h5>sendPage</h5>
  <div style="margin-left: 0 ; border: 2px">
  <a name="sendPage"></a>
  <p>
        
  <em>Function</em> <span class="codefrag">sendPage([String] uri, [Object] bean)</span>
        
  </p>
  <p>
        Passes control to the Cocoon sitemap to generate the output page.
        </p>
  <p>
        
  <span class="codefrag">uri</span> is the relative URL of the page to be sent back to the client.
        </p>
  <p>
         
  <span class="codefrag">bean</span> is a context object which can be accessed inside this page to extract
         various values and place them in the generated page.
        </p>
  </div>
  <a name="N10172"></a><a name="sendPageAndWait-N1016D"></a>
  <h5>sendPageAndWait</h5>
  <div style="margin-left: 0 ; border: 2px">
  <a name="sendPageAndWait"></a>
  <p>
      
  <em>Function</em> <span class="codefrag">[WebContinuation] sendPageAndWait([String] uri, [Object] bean, [Number] timeToLive)</span>
      
  </p>
  <p>
       Passes control to the Cocoon sitemap to generate the output page.
       </p>
  <p>The flow script is suspended after the page is generated and the whole execution stack
          saved in the WebContinuation object returned from this function. </p>
  <p>
  <span class="codefrag">uri</span> is the relative URL of the page to be sent back to the client.
          <span class="codefrag">bean</span> is a context object which can be accessed inside this page to extract
          various values and place them in the generated page.</p>
  <p>
  <span class="codefrag">timeToLive</span> is the time to live in milliseconds for the continuation created.</p>
  <p>The return value is the <a href="#WebContinuation">continuation</a> object.</p>
  </div>
  <a name="N1019D"></a><a name="processPipelineTo"></a>
  <h5>processPipelineTo</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
      
  <em>Function</em> <span class="codefrag">processPipelineTo([String] uri, [Object] bizData, [java.io.OutputStream] stream)</span>
  </p>
  <p>
       Call the Cocoon sitemap for the given URI, sending the output of the
       eventually matched pipeline to the specified <span class="codefrag">OutputStream</span>.</p>
  <p>
  <span class="codefrag">uri</span> is the URI for which the request should be generated.</p>
  <p>
  <span class="codefrag">bizData</span> is the business data object
       to be made available to the forwarded pipeline</p>
  <p>
  <span class="codefrag">stream</span> is an <span class="codefrag">OutputStream</span> where the output should be written to.</p>
  </div>
  <a name="N101C3"></a><a name="load"></a>
  <h5>load</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
  <em>Function</em> <span class="codefrag">load([String] uri)</span>
  </p>
  <p>
        Load the JavaScript script specified by <span class="codefrag">uri</span>. The Cocoon
       source resolver is used to resolve <span class="codefrag">uri</span>. 
      </p>
  </div>
  </div>
  <a name="N101DA"></a><a name="Request+Object"></a>
  <h4>Request Object</h4>
  <div style="margin-left: 0 ; border: 2px">
  <a name="request"></a>
  <p>The <span class="codefrag">Request</span> object represents the current Cocoon request. It provides the following functions and properties:</p>
  <a name="N101E7"></a><a name="get"></a>
  <h5>get</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
  <em>Function</em> <span class="codefrag">[String] get([String] name)</span>
  </p>
  <p>
        Get the request parameter or attribute with the specified <span class="codefrag">name</span>. 
      </p>
  </div>
  <a name="N101FA"></a><a name="getAttribute"></a>
  <h5>getAttribute</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
  <em>Function</em> <span class="codefrag">[String] getAttribute([String] name)</span>
  </p>
  <p>
        Get the request attribute with the specified <span class="codefrag">name</span>. 
      </p>
  </div>
  <a name="N1020D"></a><a name="getAttributeNames"></a>
  <h5>getAttributeNames</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
  <em>Function</em> <span class="codefrag">[java.util.Enumeration] getAttributeNames()</span>
  </p>
  <p>
        Get an enumeration of request attribute names. 
      </p>
  </div>
  <a name="N1021D"></a><a name="setAttribute"></a>
  <h5>setAttribute</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
  <em>Function</em> <span class="codefrag">setAttribute([String] name, [Object] value)</span>
  </p>
  <p>
        Set the value of a request attribute. 
      </p>
  </div>
  <a name="N1022D"></a><a name="removeAttribute"></a>
  <h5>removeAttribute</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
  <em>Function</em> <span class="codefrag">removeAttribute([String] name)</span>
  </p>
  <p>
        Remove the attribute with the name <span class="codefrag">name</span> from this request. 
      </p>
  </div>
  <a name="N10240"></a><a name="getCharacterEncoding"></a>
  <h5>getCharacterEncoding</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
  <em>Function</em> <span class="codefrag">[String]getCharacterEncoding()</span>
  </p>
  <p>
        Return the character encoding used by this request.
      </p>
  </div>
  <a name="N10250"></a><a name="setCharacterEncoding"></a>
  <h5>setCharacterEncoding</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
  <em>Function</em> <span class="codefrag">setCharacterEncoding([String] value)</span>
  </p>
  <p>
        Set the character encoding used by this request.
      </p>
  </div>
  <a name="N10260"></a><a name="getContentLength"></a>
  <h5>getContentLength</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
  <em>Function</em> <span class="codefrag">[Number] getContentLength()</span>
  </p>
  <p>
        Get the content-length of this request
      </p>
  </div>
  <a name="N10270"></a><a name="getContentType"></a>
  <h5>getContentType</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
  <em>Function</em> <span class="codefrag">[String] getContentType()</span>
  </p>
  <p>
        Get the content-type of this request
      </p>
  </div>
  <a name="N10280"></a><a name="getParameter"></a>
  <h5>getParameter</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
  <em>Function</em> <span class="codefrag">[String] getParameter([String] name)</span>
  </p>
  <p>
        Get the request parameter with the specified <span class="codefrag">name</span>. 
      </p>
  </div>
  <a name="N10293"></a><a name="getParameterValues"></a>
  <h5>getParameterValues</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
  <em>Function</em> <span class="codefrag">[Array] getParameterValues([String] name)</span>
  </p>
  <p>
        Get an array of request parameters with the specified <span class="codefrag">name</span>. 
      </p>
  </div>
  <a name="N102A6"></a><a name="getParameterNames"></a>
  <h5>getParameterNames</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
  <em>Function</em> <span class="codefrag">[java.util.Enumeration] getParameterNames()</span>
  </p>
  <p>
        Get an enumeration of the parameter names in this request.
      </p>
  </div>
  <a name="N102B6"></a><a name="getAuthType"></a>
  <h5>getAuthType</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
  <em>Function</em> <span class="codefrag">[String] getAuthType()</span>
  </p>
  <p>
        Get the authorization type used in this request.
      </p>
  </div>
  <a name="N102C6"></a><a name="getProtocol"></a>
  <h5>getProtocol</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
  <em>Function</em> <span class="codefrag">[String] getProtocol()</span>
  </p>
  <p>
        Get the protocol used in this request.
      </p>
  </div>
  <a name="N102D6"></a><a name="getScheme"></a>
  <h5>getScheme</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
  <em>Function</em> <span class="codefrag">[String] getScheme()</span>
  </p>
  <p>
        Get the scheme used in this request.
      </p>
  </div>
  <a name="N102E6"></a><a name="getMethod"></a>
  <h5>getMethod</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
  <em>Function</em> <span class="codefrag">[String] getMethod()</span>
  </p>
  <p>
        Get the method used in this request.
      </p>
  </div>
  <a name="N102F6"></a><a name="getServerName"></a>
  <h5>getServerName</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
  <em>Function</em> <span class="codefrag">[String] getServerName()</span>
  </p>
  <p>
        Get the server name of this request.
      </p>
  </div>
  <a name="N10306"></a><a name="getServerPort"></a>
  <h5>getServerPort</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
  <em>Function</em> <span class="codefrag">[Number] getServerPort()</span>
  </p>
  <p>
        Get the server port of this request.
      </p>
  </div>
  <a name="N10316"></a><a name="getRemoteAddr"></a>
  <h5>getRemoteAddr</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
  <em>Function</em> <span class="codefrag">[String] getRemoteAddr()</span>
  </p>
  <p>
        Get the remote address of this request.
      </p>
  </div>
  <a name="N10326"></a><a name="isSecure"></a>
  <h5>isSecure</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
  <em>Function</em> <span class="codefrag">[Boolean] isSecure()</span>
  </p>
  <p>
        Get the <span class="codefrag">secure</span> property of this request.
      </p>
  </div>
  <a name="N10339"></a><a name="getLocale"></a>
  <h5>getLocale</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
  <em>Function</em> <span class="codefrag">[String] getLocale()</span>
  </p>
  <p>
        Get the locale of this request.
      </p>
  </div>
  <a name="N10349"></a><a name="getLocales"></a>
  <h5>getLocales</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
  <em>Function</em> <span class="codefrag">[Array [String]] getLocales()</span>
  </p>
  <p>
        Get the locales of this request.
      </p>
  </div>
  <a name="N10359"></a><a name="getCookies"></a>
  <h5>getCookies</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
  <em>Function</em> <span class="codefrag">[Array [Cookie]] getCookies()</span>
  </p>
  <p>
        Get the cookies associated with this request.
      </p>
  </div>
  <a name="N10369"></a><a name="getHeader"></a>
  <h5>getHeader</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
  <em>Function</em> <span class="codefrag">[String] getHeader([String] name)</span>
  </p>
  <p>
        Get the header with <span class="codefrag">name</span> from this request.
      </p>
  </div>
  <a name="N1037C"></a><a name="getHeaders"></a>
  <h5>getHeaders</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
  <em>Function</em> <span class="codefrag">[Array] getHeaders()</span>
  </p>
  <p>
        Get the headers associated with this request.
      </p>
  </div>
  <a name="N1038C"></a><a name="getHeaderNames"></a>
  <h5>getHeaderNames</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
  <em>Function</em> <span class="codefrag">[java.util.Enumeration] getHeaderNames()</span>
  </p>
  <p>
        Get an enumeration of header names from this request.
      </p>
  </div>
  <a name="N1039C"></a><a name="getRemoteUser"></a>
  <h5>getRemoteUser</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
  <em>Function</em> <span class="codefrag">[String] getRemoteUser()</span>
  </p>
  <p>
        Get the remote user associated with this request.
      </p>
  </div>
  <a name="N103AC"></a><a name="getUserPrincipal"></a>
  <h5>getUserPrincipal</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
  <em>Function</em> <span class="codefrag">[String] getUserPrincipal()</span>
  </p>
  <p>
        Get the user principal associated with this request.
      </p>
  </div>
  <a name="N103BC"></a><a name="isUserInRole"></a>
  <h5>isUserInRole</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
  <em>Function</em> <span class="codefrag">[Boolean] isUserInRole([String] role)</span>
  </p>
  <p>
        Returns whether the user associated with this request is in the specified <span class="codefrag">role</span>.
      </p>
  </div>
  <a name="N103CF"></a><a name="Properties"></a>
  <h5>Properties</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
      
      [name] -&gt; maps to the parameter with that name. For example <span class="codefrag">request.blah</span> is equivalent to <span class="codefrag">request.getParameter("blah")</span>
      
  </p>
  </div>
  </div>
  <a name="N103DF"></a><a name="Response+Object"></a>
  <h4>Response Object</h4>
  <div style="margin-left: 0 ; border: 2px">
  <a name="response"></a>
  <p>The <span class="codefrag">Response</span> object represents the Cocoon response associated with the current request.</p>
  <p>
       The response object contains hooks only to the cookies and to the response headers. Everything else will be controlled by the rest of the cocoon pipeline machinery (like output encoding, for example, which should *NOT* be determined by the flow).
       </p>
  <p>It provides the following functions and properties:</p>
  <a name="N103F2"></a><a name="createCookie"></a>
  <h5>createCookie</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
  <em>Function</em> <span class="codefrag">[Cookie] createCookie([String] name, [String] value)</span>
  </p>
  <p>
        Creates a new <a href="#cookie">Cookie</a>. 
      </p>
  </div>
  <a name="N10406"></a><a name="addCookie"></a>
  <h5>addCookie</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
  <em>Function</em> <span class="codefrag">addCookie([Cookie] cookie)</span>
  </p>
  <p>
        Adds <span class="codefrag">cookie</span> to the current response. 
      </p>
  </div>
  <a name="N10419"></a><a name="containsHeader"></a>
  <h5>containsHeader</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
  <em>Function</em> <span class="codefrag">[Boolean] containsHeader([String] name)</span>
  </p>
  <p>
        Returns whether the current response contains a header with the specified <span class="codefrag">name</span>.
      </p>
  </div>
  <a name="N1042C"></a><a name="setHeader"></a>
  <h5>setHeader</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
  <em>Function</em> <span class="codefrag">setHeader([String] name, [String] value)</span>
  </p>
  <p>
        Replaces the value of the header with <span class="codefrag">name</span> with <span class="codefrag">value</span>.
      </p>
  </div>
  <a name="N10442"></a><a name="addHeader"></a>
  <h5>addHeader</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
  <em>Function</em> <span class="codefrag">addHeader([String] name, [String] value)</span>
  </p>
  <p>
        Creates a new header in the current response with the specified <span class="codefrag">name</span> and <span class="codefrag">value</span>.
      </p>
  </div>
  </div>
  <a name="N10459"></a><a name="Session+Object"></a>
  <h4>Session Object</h4>
  <div style="margin-left: 0 ; border: 2px">
  <a name="session"></a>
  <p>The <span class="codefrag">Session</span> object represents the user session associated with the current Cocoon request.</p>
  <p>It provides the following functions and properties:</p>
  <a name="N10469"></a><a name="getAttribute-N10464"></a>
  <h5>getAttribute</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
  <em>Function</em> <span class="codefrag">[Object] getAttribute([String] name)</span>
  </p>
  <p>
        Get the value of the session attribute with the specified <span class="codefrag">name</span>.
      </p>
  </div>
  <a name="N1047C"></a><a name="setAttribute-N10477"></a>
  <h5>setAttribute</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
  <em>Function</em> <span class="codefrag">setAttribute([String] name, [Object] value)</span>
  </p>
  <p>
        Set the value of the session attribute with the specified <span class="codefrag">name</span> to <span class="codefrag">value</span>.
      </p>
  </div>
  <a name="N10492"></a><a name="removeAttribute-N1048D"></a>
  <h5>removeAttribute</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
  <em>Function</em> <span class="codefrag">removeAttribute([String] name)</span>
  </p>
  <p>
        Remove the session attribute with the specified <span class="codefrag">name</span>.
      </p>
  </div>
  <a name="N104A5"></a><a name="invalidate"></a>
  <h5>invalidate</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
  <em>Function</em> <span class="codefrag">invalidate()</span>
  </p>
  <p>
        Invalidate this session, releasing all resources associated with it.
      </p>
  </div>
  <a name="N104B5"></a><a name="isNew"></a>
  <h5>isNew</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
  <em>Function</em> <span class="codefrag">[Boolean] isNew()</span>
  </p>
  <p>
        Returns <span class="codefrag">true</span> if the client does not yet know about the
        session or if the client chooses not to join the session.  For
        example, if the server used only cookie-based sessions, and
        the client had disabled the use of cookies, then a session would
        be new on each request.
      </p>
  </div>
  <a name="N104C8"></a><a name="getId"></a>
  <h5>getId</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
  <em>Function</em> <span class="codefrag">[String] getId()</span>
  </p>
  <p>
        Returns the unique id associated with this session.
      </p>
  </div>
  <a name="N104D8"></a><a name="getCreationTime"></a>
  <h5>getCreationTime</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
  <em>Function</em> <span class="codefrag">[Number] getCreationTime()</span>
  </p>
  <p>
        Returns the time when this session was created, measured
        in milliseconds since midnight January 1, 1970 GMT.
      </p>
  </div>
  <a name="N104E8"></a><a name="getLastAccessedTime"></a>
  <h5>getLastAccessedTime</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
  <em>Function</em> <span class="codefrag">[Number] getLastAccessedTime()</span>
  </p>
  <p>
        Returns the last time the client sent a request associated with
        this session, as the number of milliseconds since midnight
        January 1, 1970 GMT.
      </p>
  </div>
  <a name="N104F8"></a><a name="setMaxInactiveInterval"></a>
  <h5>setMaxInactiveInterval</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
  <em>Function</em> <span class="codefrag">setMaxInactiveInterval([Number] interval)</span>
  </p>
  <p>
        Specifies the time, in seconds, between client requests before the
        contextcontainer will invalidate this session.  A negative time
        indicates the session should never timeout.
      </p>
  </div>
  <a name="N10508"></a><a name="getMaxInactiveInterval"></a>
  <h5>getMaxInactiveInterval</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
  <em>Function</em> <span class="codefrag">[Number] getMaxInactiveInterval()</span>
  </p>
  <p>
       Returns the maximum time interval, in seconds, that
       the context container will keep this session open between
       client accesses. After this interval, the context container
       will invalidate the session.  The maximum time interval can be set
       with the <span class="codefrag">setMaxInactiveInterval</span> method.
       A negative time indicates the session should never timeout.
      </p>
  </div>
  <a name="N1051B"></a><a name="Properties-N10516"></a>
  <h5>Properties</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
        [name] -&gt; maps to the attribute indicates with the name</p>
  <p>For example session.blah is equivalent to session.getAttribute("blah") 
      </p>
  </div>
  </div>
  <a name="N10528"></a><a name="Context+Object"></a>
  <h4>Context Object</h4>
  <div style="margin-left: 0 ; border: 2px">
  <a name="context"></a>
  <p>The <span class="codefrag">Context</span> object represents the client context associated with the current Cocoon request.</p>
  <p>It provides the following functions and properties:</p>
  <a name="N10538"></a><a name="getAttribute-N10533"></a>
  <h5>getAttribute</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
  <em>Function</em> <span class="codefrag">[Object] getAttribute([String] name)</span>
  </p>
  <p>
        Get the value of the context attribute with the specified <span class="codefrag">name</span>.
      </p>
  </div>
  <a name="N1054B"></a><a name="setAttribute-N10546"></a>
  <h5>setAttribute</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
  <em>Function</em> <span class="codefrag">setAttribute([String] name, [Object] value)</span>
  </p>
  <p>
        Set the value of the context attribute with the specified <span class="codefrag">name</span> to <span class="codefrag">value</span>.
      </p>
  </div>
  <a name="N10561"></a><a name="removeAttribute-N1055C"></a>
  <h5>removeAttribute</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
  <em>Function</em> <span class="codefrag">removeAttribute([String] name)</span>
  </p>
  <p>
        Remove the context attribute with the specified <span class="codefrag">name</span>.
      </p>
  </div>
  <a name="N10574"></a><a name="getInitParameter"></a>
  <h5>getInitParameter</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
  <em>Function</em> <span class="codefrag">getInitParameter([String] name)</span>
  </p>
  <p>
        Get the value of the context initialization parameter with the specified <span class="codefrag">name</span>.
      </p>
  </div>
  <a name="N10587"></a><a name="Properties-N10582"></a>
  <h5>Properties</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
        [name] -&gt; maps to the attribute indicates with the name</p>
  <p>For example context.blah is equivalent to context.getAttribute("blah") 
      </p>
  </div>
  </div>
  <a name="N10594"></a><a name="Cookie+Object"></a>
  <h4>Cookie Object</h4>
  <div style="margin-left: 0 ; border: 2px">
  <a name="cookie"></a>
  <p>
  <span class="codefrag">Cookie</span> provides the following functions and properties:</p>
  <a name="N105A0"></a><a name="getName"></a>
  <h5>getName</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
  <em>Function</em> <span class="codefrag">[String] getName()</span>
  </p>
  <p>
         Get the name of this cookie.
      </p>
  </div>
  <a name="N105B0"></a><a name="getVersion"></a>
  <h5>getVersion</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
  <em>Function</em> <span class="codefrag">[String] getVersion()</span>
  </p>
  <p>
         Get the version of this cookie.
      </p>
  </div>
  <a name="N105C0"></a><a name="setVersion"></a>
  <h5>setVersion</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
  <em>Function</em> <span class="codefrag">setVersion([String] version)</span>
  </p>
  <p>
         Set the version of this cookie.
      </p>
  </div>
  <a name="N105D0"></a><a name="getValue"></a>
  <h5>getValue</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
  <em>Function</em> <span class="codefrag">[String] getValue()</span>
  </p>
  <p>
         Get the value of this cookie.
      </p>
  </div>
  <a name="N105E0"></a><a name="setValue"></a>
  <h5>setValue</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
  <em>Function</em> <span class="codefrag">setValue([String] value)</span>
  </p>
  <p>
         Set the value of this cookie.
      </p>
  </div>
  <a name="N105F0"></a><a name="getComment"></a>
  <h5>getComment</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
  <em>Function</em> <span class="codefrag">[String] getComment()</span>
  </p>
  <p>
         Get the comment of this cookie.
      </p>
  </div>
  <a name="N10600"></a><a name="setComment"></a>
  <h5>setComment</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
  <em>Function</em> <span class="codefrag">setComment([String] comment)</span>
  </p>
  <p>
         Set the comment of this cookie.
      </p>
  </div>
  <a name="N10610"></a><a name="getDomain"></a>
  <h5>getDomain</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
  <em>Function</em> <span class="codefrag">[String] getDomain()</span>
  </p>
  <p>
         Get the domain of this cookie.
      </p>
  </div>
  <a name="N10620"></a><a name="setDomain"></a>
  <h5>setDomain</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
  <em>Function</em> <span class="codefrag">setDomain([String] domain)</span>
  </p>
  <p>
         Set the domain of this cookie.
      </p>
  </div>
  <a name="N10630"></a><a name="getPath"></a>
  <h5>getPath</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
  <em>Function</em> <span class="codefrag">[String] getPath()</span>
  </p>
  <p>
         Get the path of this cookie.
      </p>
  </div>
  <a name="N10640"></a><a name="setPath"></a>
  <h5>setPath</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
  <em>Function</em> <span class="codefrag">setPath([String] path)</span>
  </p>
  <p>
         Set the path of this cookie.
      </p>
  </div>
  <a name="N10650"></a><a name="getSecure"></a>
  <h5>getSecure</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
  <em>Function</em> <span class="codefrag">[Boolean] getSecure()</span>
  </p>
  <p>
         Get the secure property of this cookie.
      </p>
  </div>
  <a name="N10660"></a><a name="setSecure"></a>
  <h5>setSecure</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
  <em>Function</em> <span class="codefrag">setSecure([Boolean] value)</span>
  </p>
  <p>
         Set the secure property of this cookie.
      </p>
  </div>
  </div>
  <a name="N10671"></a><a name="Log+Object"></a>
  <h4>Log Object</h4>
  <div style="margin-left: 0 ; border: 2px">
  <a name="log"></a>
  <p> The <span class="codefrag">log</span> object provides an interface to the Cocoon logging system.
      </p>
  <p>
          It supports the following functions:
      </p>
  <a name="N10681"></a><a name="error"></a>
  <h5>error</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
          
  <em>Function</em> <span class="codefrag">error([String] message)</span>
      
  </p>
  <p>
        Log an error message.
      </p>
  </div>
  <a name="N10693"></a><a name="debug"></a>
  <h5>debug</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
          
  <em>Function</em> <span class="codefrag">debug([String] message)</span>
      
  </p>
  <p>
        Log a debug message.
      </p>
  </div>
  <a name="N106A5"></a><a name="warn"></a>
  <h5>warn</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
          
  <em>Function</em> <span class="codefrag">warn([String] message)</span>
      
  </p>
  <p>
        Log a warning message.
      </p>
  </div>
  <a name="N106B7"></a><a name="info"></a>
  <h5>info</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
          
  <em>Function</em> <span class="codefrag">info([String] message)</span>
      
  </p>
  <p>
        Log an information message.
      </p>
  </div>
  <a name="N106C9"></a><a name="isErrorEnabled"></a>
  <h5>isErrorEnabled</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
          
  <em>Function</em> <span class="codefrag">[Boolean] isErrorEnabled()</span>
      
  </p>
  <p>
        Returns whether error message logging is enabled.
      </p>
  </div>
  <a name="N106DB"></a><a name="isDebugEnabled"></a>
  <h5>isDebugEnabled</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
          
  <em>Function</em> <span class="codefrag">[Boolean] isDebugEnabled()</span>
      
  </p>
  <p>
        Returns whether debug message logging is enabled.
      </p>
  </div>
  <a name="N106ED"></a><a name="isWarnEnabled"></a>
  <h5>isWarnEnabled</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
          
  <em>Function</em> <span class="codefrag">[Boolean] isWarnEnabled()</span>
      
  </p>
  <p>
        Returns whether warning message logging is enabled.
      </p>
  </div>
  <a name="N106FF"></a><a name="isInfoEnabled"></a>
  <h5>isInfoEnabled</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
          
  <em>Function</em> <span class="codefrag">[Boolean] isInfoEnabled()</span>
      
  </p>
  <p>
        Returns whether information message logging is enabled
      </p>
  </div>
  </div>
  <a name="N10712"></a><a name="WebContinuation-N1070D"></a>
  <h4>WebContinuation</h4>
  <div style="margin-left: 0 ; border: 2px">
  <a name="WebContinuation"></a>
  <p>A <span class="codefrag">WebContinuation</span> represents a continuation of a Flowscript. Because a user may click on the back button in the browser and restart a saved computation in a continuation, each <span class="codefrag">WebContinuation</span> becomes the parent of a subtree of continuations.
      </p>
  <p>
         If there is no parent <span class="codefrag">WebContinuation</span>, the created continuation becomes the root of a tree of <span class="codefrag">WebContinuation</span>s.
      </p>
  <p>
         
  <span class="codefrag">WebContinuation</span> objects support the following functions and properties:
      </p>
  <a name="N10731"></a><a name="getParent"></a>
  <h5>getParent</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
          
  <em>Function</em> <span class="codefrag">[WebContinuation] getParent()</span>
      
  </p>
  <p>
       Get the parent continuation of this continuation.
      </p>
  </div>
  <a name="N10743"></a><a name="getChildren"></a>
  <h5>getChildren</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
          
  <em>Function</em> <span class="codefrag">[Array [WebContinuation]] getChildren()</span>
      
  </p>
  <p>
       Get the child continuations of this continuation.
      </p>
  </div>
  <a name="N10755"></a><a name="invalidate-N10750"></a>
  <h5>invalidate</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
          
  <em>Function</em> <span class="codefrag">invalidate()</span>
      
  </p>
  <p>
        Invalidates a <span class="codefrag">WebContinuation</span>. This effectively
        means that the continuation object associated with it will no
        longer be accessible from Web pages. Invalidating a
        <span class="codefrag">WebContinuation</span> invalidates all the
        <span class="codefrag">WebContinuation</span>s which are children of it.    
      </p>
  </div>
  <a name="N10770"></a><a name="id"></a>
  <h5>id</h5>
  <div style="margin-left: 0 ; border: 2px">
  <p>
  <em>Property</em> <span class="codefrag">[String] id</span>
  </p>
  <p>Returns the unique string identifier of this continuation</p>
  </div>
  </div>
  </div>
    
  </div>
  </td><td width="10"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <!--================= end Content==================-->
  </table>
  </td>
  </tr>
  </table>
  <!--================= end Menu, NavBar, Content ==================-->
  <!--================= start Footer ==================-->
  <table summary="footer" cellspacing="0" cellpadding="0" width="100%" border="0">
  <tr>
  <td colspan="2" height="1" bgcolor="#4C6C8F"><img height="1" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"><a href="../../skin/images/label.gif"></a><a href="../../skin/images/page.gif"></a><a href="../../skin/images/chapter.gif"></a><a href="../../skin/images/chapter_open.gif"></a><a href="../../skin/images/current.gif"></a><a href="../..//favicon.ico"></a></td>
  </tr>
  <tr>
  <td colspan="2" bgcolor="#CFDCED" class="copyright" align="center"><font size="2" face="Arial, Helvetica, Sans-Serif">Copyright &copy;
            1999-2003&nbsp;The Apache Software Foundation. All rights reserved.<script type="text/javascript" language="JavaScript"><!--
                document.write(" - "+"Last Published: " + document.lastModified);
              //  --></script></font></td>
  </tr>
  <tr>
  <td colspan="2" align="left" bgcolor="#CFDCED" class="logos"></td>
  </tr>
  </table>
  <!--================= end Footer ==================-->
  </body>
  </html>
  
  
  
  1.1                  cocoon-site/site/2.1/userdocs/flow/api.pdf
  
  	<<Binary file>>
  
  
  1.1                  cocoon-site/site/2.1/userdocs/flow/jpath.html
  
  Index: jpath.html
  ===================================================================
  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  <html>
  <head>
  <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  <title>Advanced Control Flow</title>
  <link type="text/css" href="../../skin/page.css" rel="stylesheet">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
  <!--================= start Navigation Path ==================-->
  <table summary="navigation path" width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td nowrap="nowrap" valign="middle" bgcolor="#CFDCED" height="20"><img height="1" width="5" alt="" src="../../skin/images/spacer.gif" class="spacer"><!--===== breadcrumb trail (javascript-generated) ====--><font size="2" face="Arial, Helvetica, Sans-serif"><script src="../../skin/breadcrumbs.js" language="JavaScript" type="text/javascript"></script></font></td>
  </tr>
  <tr>
  <td bgcolor="#4C6C8F" height="2"><img height="2" width="2" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  </table>
  <!--================= end Navigation Path ==================-->
  <!--================= start Banner ==================-->
  <table summary="header with logos" width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <!--================= start Group Logo ==================-->
  <td bgcolor="#294563"><a href=""></a></td>
  <!--================= end Group Logo ==================-->
  <!--================= start Project Logo ==================--><td width="100%" align="center" bgcolor="#294563"><a href="http://cocoon.apache.org/"><img border="0" class="logoImage" alt="Apache Cocoon" src="../../images/project-logo.gif"></a></td>
  <!--================= end Project Logo ==================-->
  <!--================= start Search ==================--><td valign="top" rowspan="2" bgcolor="#294563">
  <form target="_blank" action="http://www.google.com/search" method="get">
  <table summary="search" border="0" cellspacing="0" cellpadding="0" bgcolor="#4C6C8F">
  <tr>
  <td colspan="3"><img height="10" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td><img height="1" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td nowrap="nowrap"><input value="cocoon.apache.org" name="sitesearch" type="hidden"><input size="15" name="q" id="query" type="text"><img height="1" width="5" alt="" src="../../skin/images/spacer.gif" class="spacer"><input name="Search" value="Search" type="submit">
  <br>
  <font face="Arial, Helvetica, Sans-serif" size="2" color="white">
                        the Apache Cocoon site
                        
                        
                      </font></td><td><img height="1" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td><img alt="" border="0" height="10" width="9" src="../../skin/images/search-left.gif"></td><td><img height="1" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td><img alt="" border="0" height="10" width="9" src="../../skin/images/search-right.gif"></td>
  </tr>
  </table>
  </form>
  </td>
  <!--================= start Search ==================--><td bgcolor="#294563"><img height="10" width="10" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td valign="bottom" bgcolor="#294563" colspan="2">
  <!--================= start Tabs ==================-->
  <div class="tab">
  <table summary="tab bar" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td width="6"><img alt="" height="8" width="6" src="../../skin/images/spacer.gif"></td><td valign="bottom">
  <table summary="selected tab" style="height: 1.8em" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td valign="top" width="5" bgcolor="#4C6C8F"><img height="5" width="5" alt="" src="../../skin/images/tabSel-left.gif"></td><td valign="middle" bgcolor="#4C6C8F"><font color="#ffffff" size="2" face="Arial, Helvetica, Sans-serif"><b><a href="../../index.html"><font color="#000000">Home</font></a></b></font></td><td valign="top" width="5" bgcolor="#4C6C8F"><img height="5" width="5" alt="" src="../../skin/images/tabSel-right.gif"></td>
  </tr>
  </table>
  </td>
  </tr>
  </table>
  </div>
  <!--================= end Tabs ==================-->
  </td><td bgcolor="#294563"><img alt="" width="1" height="1" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td bgcolor="#4C6C8F" colspan="4"><img width="1" height="10" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  </table>
  <!--================= end Banner ==================-->
  <!--================= start Menu, NavBar, Content ==================-->
  <table summary="page content" bgcolor="#ffffff" width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td valign="top">
  <table summary="menu" border="0" cellspacing="0" cellpadding="0">
  <tr>
  <!--================= start left top NavBar ==================-->
  <td rowspan="3" valign="top">
  <table summary="blue line" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td bgcolor="#294563"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td bgcolor="#CFDCED"><font color="#4C6C8F" size="4" face="Arial, Helvetica, Sans-serif">&nbsp;</font></td>
  </tr>
  <tr>
  <td bgcolor="#294563"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  </table>
  </td>
  <!--================= end left top NavBar ==================--><td bgcolor="#294563"><img width="1" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td valign="bottom" bgcolor="#4C6C8F"><img width="10" height="10" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td nowrap="nowrap" valign="top" bgcolor="#4C6C8F">
  <!--================= start Menu items ==================-->
  <div class="menu">
  <ul>
  <li>
  <font color="#CFDCED">Navigation</font>
  <ul>
      
  <li>
  <a href="../../index.html">Main</a>
  </li>
      
  <li>
  <a href="../index.html">User Documentation</a>
  </li>
    
  </ul>
  </li>
  <li>
  <font color="#CFDCED">Flowscript</font>
  <ul>
      
  <li>
  <a href="index.html">Introduction</a>
  </li>
      
  <li>
  <a href="continuations.html">Continuations</a>
  </li>
      
  <li>
  <a href="how-does-it-work.html">How does it work?</a>
  </li>
      
  <li>
  <a href="using.html">Usage</a>
  </li>
      
  <li>
  <a href="sitemap.html">Sitemap</a>
  </li>
      
  <li>
  <a href="api.html">JavaScript API</a>
  </li>
      
  <li>
  <a href="views.html">Views</a>
  </li>
      
  <li>
  <a href="jxtemplate.html">JXTemplate</a>
  </li>
      
  <li>
  <span class="sel"><font color="#ffcc00">JPath</font></span>
  </li>
      
  <li>
  <a href="velocity.html">Velocity</a>
  </li> 
      
  <li>
  <a href="jxforms.html">JXForms</a>
  </li>
      
  <li>
  <a href="woody.html">Woody</a>
  </li>
    
  </ul>
  </li>
  </ul>
  </div>
  <!--================= end Menu items ==================-->
  </td><td valign="bottom" bgcolor="#4C6C8F"><img width="10" height="10" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td bgcolor="#294563"><img width="1" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td valign="bottom" align="left" colspan="2" rowspan="2" bgcolor="#4C6C8F"><img height="10" width="10" border="0" alt="" src="../../skin/images/menu-left.gif"></td><td bgcolor="#4C6C8F"><img height="10" width="10" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td valign="bottom" align="right" colspan="2" rowspan="2" bgcolor="#4C6C8F"><img height="10" width="10" border="0" alt="" src="../../skin/images/menu-right.gif"></td>
  </tr>
  <tr>
  <td height="1" bgcolor="#294563"><img width="1" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  </table>
  </td><td valign="top" width="100%">
  <table summary="content" width="100%" border="0" cellpadding="0" cellspacing="0">
  <!--================= start middle NavBar ==================-->
  <tr>
  <td colspan="4" bgcolor="#294563"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td align="left" width="10" bgcolor="#CFDCED"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td align="left" width="50%" bgcolor="#CFDCED"><font color="#4C6C8F" size="3" face="Arial, Helvetica, Sans-serif">
                  &nbsp;
                  
                  </font><img width="10" height="8" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td align="right" width="50%" bgcolor="#CFDCED"><font color="#4C6C8F" size="3" face="Arial, Helvetica, Sans-serif">
                  &nbsp;
                  
                  </font><img width="10" height="8" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td width="10" bgcolor="#CFDCED"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td colspan="4" bgcolor="#294563"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <!--================= end middle NavBar ==================-->
  <!--================= start Content==================-->
  <tr>
  <td align="left" width="10"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td align="left" width="100%">
  <div class="content">
  <table class="title" summary="">
  <tr>
  <td valign="middle">
  <h1>Advanced Control Flow</h1>
  </td><script Language="Javascript">
  
  function printit(){  
  if (window.print) {
      window.print() ;  
  } else {
      var WebBrowser = '<OBJECT CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" HEIGHT="0" WIDTH="0" ID="WebBrowser1"></OBJECT>';
  document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
      WebBrowser1.ExecWB(6, 2);//Use a 1 vs. a 2 for a prompting dialog box    WebBrowser1.outerHTML = "";  
  }
  }
  </script><script Language="Javascript">  
  var NS = (navigator.appName == "Netscape");
  var VERSION = parseInt(navigator.appVersion);
  if (VERSION > 3) {
      document.write('<td nowrap="nowrap" width="40" align="center">');     
      document.write('  <a class="dida" href="javascript:printit()">');        
      document.write('    <img alt="Print this Page" src="../../skin/images/printer.gif" class="skin"><br>');   
      document.write('  print</a>');   
      document.write('</td>');           
  }
  </script><td nowrap="nowrap" width="40" align="center"><a class="dida" href="jpath.pdf"><img alt="PDF" src="../../skin/images/pdfdoc.gif" class="skin"><br>
            PDF</a></td>
  </tr>
  </table>
  <p>
  <font size="-2">by&nbsp;Christopher Oliver,&nbsp;Ovidiu Predescu</font>
  </p>
  <ul class="minitoc">
  <li>
  <a href="#JPath+Logic+Sheet">JPath Logic Sheet</a>
  </li>
  <li>
  <a href="#Tags">Tags</a>
  <ul class="minitoc">
  <li>
  <a href="#if">if</a>
  </li>
  <li>
  <a href="#choose">choose</a>
  </li>
  <li>
  <a href="#value-of">value-of</a>
  </li>
  <li>
  <a href="#for-each">for-each</a>
  </li>
  <li>
  <a href="#continuation">continuation</a>
  </li>
  </ul>
  </li>
  </ul>
     
  <a name="N10017"></a><a name="JPath+Logic+Sheet"></a>
  <h3>JPath Logic Sheet</h3>
  <div style="margin-left: 0 ; border: 2px">
  <p>
       The JPath Logic Sheet is an <a href="../xsp/index.html">XSP</a> logic sheet that allows
       you to access data from a Cocoon Flowscript in an XSP page and inject it into a Cocoon
       pipeline. It provides a set of tags (similar to the those defined by
       <a href="http://www.w3.org/TR/xslt">XSLT</a>) that allow you to iterate over Java
       collections (and Java or JavaScript arrays) and to test for the presence of optional or
       alternate bean properties. It is based on
       <a href="http://jakarta.apache.org/commons/jxpath">Apache JXPath</a>.
      </p>
  </div>
     
  <a name="N1002C"></a><a name="Tags"></a>
  <h3>Tags</h3>
  <div style="margin-left: 0 ; border: 2px">
  <p>The JPath tags are defined in the namespace</p>
  <pre class="code">http://apache.org/xsp/jpath/1.0</pre>
  <a name="N10039"></a><a name="if"></a>
  <h4>if</h4>
  <div style="margin-left: 0 ; border: 2px">
  <p>The <span class="codefrag">if</span> tag allows the conditional execution of its body according to value of its <span class="codefrag">test</span> attribute:</p>
  <pre class="code">
  &lt;if test="XPathExpression"&gt;
    body
  &lt;/if&gt;
       </pre>
  <p>Example:</p>
  <pre class="code">
  &lt;jpath:if test="cart/numberOfItems = 0"&gt;
    Your cart is empty
  &lt;/jpath:if&gt;
       </pre>
  </div>
  <a name="N10055"></a><a name="choose"></a>
  <h4>choose</h4>
  <div style="margin-left: 0 ; border: 2px">
  <p>The <span class="codefrag">choose</span> tag performs conditional block execution by its embedded
          <span class="codefrag">when</span> sub tags. It renders the body of the first <span class="codefrag">when</span> tag whose
          <span class="codefrag">test</span> condition evaluates to true. If none of the <span class="codefrag">test</span> conditions
          of its nested <span class="codefrag">when</span> tags evaluate to <span class="codefrag">true</span>, then the body of its
          <span class="codefrag">otherwise</span> tag is evaluated, if present:</p>
  <pre class="code">
  &lt;choose&gt;
    &lt;when test="XPathExpression"&gt;
      body
    &lt;/when&gt;+
    &lt;otherwise&gt;
      body
    &lt;/otherwise&gt;?
  &lt;/choose&gt;
       </pre>
  <p>Example:</p>
  <pre class="code">
  &lt;choose&gt;
    &lt;when test="not(user/loggedIn)"&gt;
       You're not logged in
    &lt;/when&gt;
    &lt;otherwise&gt;
       You're already logged in
    &lt;/otherwise&gt;
  &lt;/choose&gt;
       </pre>
  </div>
  <a name="N10083"></a><a name="value-of"></a>
  <h4>value-of</h4>
  <div style="margin-left: 0 ; border: 2px">
  <p>The <span class="codefrag">value-of</span> tag evaluates an expression and outputs the result of the evaluation:</p>
  <pre class="code">
  &lt;value-of select="XPathExpression"/&gt;
       </pre>
  <p>Example:</p>
  <pre class="code">
  &lt;value-of select="cart/numberOfItems"&gt;
       </pre>
  </div>
  <a name="N1009C"></a><a name="for-each"></a>
  <h4>for-each</h4>
  <div style="margin-left: 0 ; border: 2px">
  <p>The <span class="codefrag">for-each</span> tag allows you to iterate over a collection of objects:</p>
  <pre class="code">
  &lt;for-each select="XPathExpression"&gt;
    body
  &lt;/for-each&gt;
       </pre>
  <p>When using XPath expressions within <span class="codefrag">for-each</span> the current element is the
          context node and can be referenced with XPath dot operator:</p>
  <pre class="code">.</pre>
  <p>Example:</p>
  <pre class="code">
  &lt;for-each select="cart/cartItems[position() &lt;= $count]"&gt;
     &lt;td&gt;&lt;value-of select="./productId"&gt;&lt;/td&gt;
  &lt;/for-each&gt;
       </pre>
  </div>
  <a name="N100C0"></a><a name="continuation"></a>
  <h4>continuation</h4>
  <div style="margin-left: 0 ; border: 2px">
  <p>The <span class="codefrag">continuation</span> tag returns the id of the current web continuation of your
          Flowscript. You can refer to previous continuations by supplying the optional
          <span class="codefrag">level</span> attribute. Zero is the current level, <span class="codefrag">-1</span> refers to the
          previous continuation, and so on.</p>
  <pre class="code">
  &lt;continuation [level="Number"]/&gt;
       </pre>
  <p>Example:</p>
  <pre class="code">
  &lt;xsp:attribute name="action"&gt;&lt;xsp:expr&gt;&lt;jpath:continuation/&gt;+".form"&lt;/xsp:expr&gt;&lt;/xsp:attribute&gt;
       </pre>
  </div>
  </div>
    
  </div>
  </td><td width="10"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <!--================= end Content==================-->
  </table>
  </td>
  </tr>
  </table>
  <!--================= end Menu, NavBar, Content ==================-->
  <!--================= start Footer ==================-->
  <table summary="footer" cellspacing="0" cellpadding="0" width="100%" border="0">
  <tr>
  <td colspan="2" height="1" bgcolor="#4C6C8F"><img height="1" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"><a href="../../skin/images/label.gif"></a><a href="../../skin/images/page.gif"></a><a href="../../skin/images/chapter.gif"></a><a href="../../skin/images/chapter_open.gif"></a><a href="../../skin/images/current.gif"></a><a href="../..//favicon.ico"></a></td>
  </tr>
  <tr>
  <td colspan="2" bgcolor="#CFDCED" class="copyright" align="center"><font size="2" face="Arial, Helvetica, Sans-Serif">Copyright &copy;
            1999-2003&nbsp;The Apache Software Foundation. All rights reserved.<script type="text/javascript" language="JavaScript"><!--
                document.write(" - "+"Last Published: " + document.lastModified);
              //  --></script></font></td>
  </tr>
  <tr>
  <td colspan="2" align="left" bgcolor="#CFDCED" class="logos"></td>
  </tr>
  </table>
  <!--================= end Footer ==================-->
  </body>
  </html>
  
  
  
  1.1                  cocoon-site/site/2.1/userdocs/flow/jpath.pdf
  
  	<<Binary file>>
  
  
  1.1                  cocoon-site/site/2.1/userdocs/flow/jxforms.html
  
  Index: jxforms.html
  ===================================================================
  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  <html>
  <head>
  <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  <title>Advanced Control Flow</title>
  <link type="text/css" href="../../skin/page.css" rel="stylesheet">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
  <!--================= start Navigation Path ==================-->
  <table summary="navigation path" width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td nowrap="nowrap" valign="middle" bgcolor="#CFDCED" height="20"><img height="1" width="5" alt="" src="../../skin/images/spacer.gif" class="spacer"><!--===== breadcrumb trail (javascript-generated) ====--><font size="2" face="Arial, Helvetica, Sans-serif"><script src="../../skin/breadcrumbs.js" language="JavaScript" type="text/javascript"></script></font></td>
  </tr>
  <tr>
  <td bgcolor="#4C6C8F" height="2"><img height="2" width="2" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  </table>
  <!--================= end Navigation Path ==================-->
  <!--================= start Banner ==================-->
  <table summary="header with logos" width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <!--================= start Group Logo ==================-->
  <td bgcolor="#294563"><a href=""></a></td>
  <!--================= end Group Logo ==================-->
  <!--================= start Project Logo ==================--><td width="100%" align="center" bgcolor="#294563"><a href="http://cocoon.apache.org/"><img border="0" class="logoImage" alt="Apache Cocoon" src="../../images/project-logo.gif"></a></td>
  <!--================= end Project Logo ==================-->
  <!--================= start Search ==================--><td valign="top" rowspan="2" bgcolor="#294563">
  <form target="_blank" action="http://www.google.com/search" method="get">
  <table summary="search" border="0" cellspacing="0" cellpadding="0" bgcolor="#4C6C8F">
  <tr>
  <td colspan="3"><img height="10" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td><img height="1" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td nowrap="nowrap"><input value="cocoon.apache.org" name="sitesearch" type="hidden"><input size="15" name="q" id="query" type="text"><img height="1" width="5" alt="" src="../../skin/images/spacer.gif" class="spacer"><input name="Search" value="Search" type="submit">
  <br>
  <font face="Arial, Helvetica, Sans-serif" size="2" color="white">
                        the Apache Cocoon site
                        
                        
                      </font></td><td><img height="1" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td><img alt="" border="0" height="10" width="9" src="../../skin/images/search-left.gif"></td><td><img height="1" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td><img alt="" border="0" height="10" width="9" src="../../skin/images/search-right.gif"></td>
  </tr>
  </table>
  </form>
  </td>
  <!--================= start Search ==================--><td bgcolor="#294563"><img height="10" width="10" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td valign="bottom" bgcolor="#294563" colspan="2">
  <!--================= start Tabs ==================-->
  <div class="tab">
  <table summary="tab bar" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td width="6"><img alt="" height="8" width="6" src="../../skin/images/spacer.gif"></td><td valign="bottom">
  <table summary="selected tab" style="height: 1.8em" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td valign="top" width="5" bgcolor="#4C6C8F"><img height="5" width="5" alt="" src="../../skin/images/tabSel-left.gif"></td><td valign="middle" bgcolor="#4C6C8F"><font color="#ffffff" size="2" face="Arial, Helvetica, Sans-serif"><b><a href="../../index.html"><font color="#000000">Home</font></a></b></font></td><td valign="top" width="5" bgcolor="#4C6C8F"><img height="5" width="5" alt="" src="../../skin/images/tabSel-right.gif"></td>
  </tr>
  </table>
  </td>
  </tr>
  </table>
  </div>
  <!--================= end Tabs ==================-->
  </td><td bgcolor="#294563"><img alt="" width="1" height="1" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td bgcolor="#4C6C8F" colspan="4"><img width="1" height="10" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  </table>
  <!--================= end Banner ==================-->
  <!--================= start Menu, NavBar, Content ==================-->
  <table summary="page content" bgcolor="#ffffff" width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td valign="top">
  <table summary="menu" border="0" cellspacing="0" cellpadding="0">
  <tr>
  <!--================= start left top NavBar ==================-->
  <td rowspan="3" valign="top">
  <table summary="blue line" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td bgcolor="#294563"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td bgcolor="#CFDCED"><font color="#4C6C8F" size="4" face="Arial, Helvetica, Sans-serif">&nbsp;</font></td>
  </tr>
  <tr>
  <td bgcolor="#294563"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  </table>
  </td>
  <!--================= end left top NavBar ==================--><td bgcolor="#294563"><img width="1" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td valign="bottom" bgcolor="#4C6C8F"><img width="10" height="10" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td nowrap="nowrap" valign="top" bgcolor="#4C6C8F">
  <!--================= start Menu items ==================-->
  <div class="menu">
  <ul>
  <li>
  <font color="#CFDCED">Navigation</font>
  <ul>
      
  <li>
  <a href="../../index.html">Main</a>
  </li>
      
  <li>
  <a href="../index.html">User Documentation</a>
  </li>
    
  </ul>
  </li>
  <li>
  <font color="#CFDCED">Flowscript</font>
  <ul>
      
  <li>
  <a href="index.html">Introduction</a>
  </li>
      
  <li>
  <a href="continuations.html">Continuations</a>
  </li>
      
  <li>
  <a href="how-does-it-work.html">How does it work?</a>
  </li>
      
  <li>
  <a href="using.html">Usage</a>
  </li>
      
  <li>
  <a href="sitemap.html">Sitemap</a>
  </li>
      
  <li>
  <a href="api.html">JavaScript API</a>
  </li>
      
  <li>
  <a href="views.html">Views</a>
  </li>
      
  <li>
  <a href="jxtemplate.html">JXTemplate</a>
  </li>
      
  <li>
  <a href="jpath.html">JPath</a>
  </li>
      
  <li>
  <a href="velocity.html">Velocity</a>
  </li> 
      
  <li>
  <span class="sel"><font color="#ffcc00">JXForms</font></span>
  </li>
      
  <li>
  <a href="woody.html">Woody</a>
  </li>
    
  </ul>
  </li>
  </ul>
  </div>
  <!--================= end Menu items ==================-->
  </td><td valign="bottom" bgcolor="#4C6C8F"><img width="10" height="10" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td bgcolor="#294563"><img width="1" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td valign="bottom" align="left" colspan="2" rowspan="2" bgcolor="#4C6C8F"><img height="10" width="10" border="0" alt="" src="../../skin/images/menu-left.gif"></td><td bgcolor="#4C6C8F"><img height="10" width="10" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td valign="bottom" align="right" colspan="2" rowspan="2" bgcolor="#4C6C8F"><img height="10" width="10" border="0" alt="" src="../../skin/images/menu-right.gif"></td>
  </tr>
  <tr>
  <td height="1" bgcolor="#294563"><img width="1" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  </table>
  </td><td valign="top" width="100%">
  <table summary="content" width="100%" border="0" cellpadding="0" cellspacing="0">
  <!--================= start middle NavBar ==================-->
  <tr>
  <td colspan="4" bgcolor="#294563"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td align="left" width="10" bgcolor="#CFDCED"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td align="left" width="50%" bgcolor="#CFDCED"><font color="#4C6C8F" size="3" face="Arial, Helvetica, Sans-serif">
                  &nbsp;
                  
                  </font><img width="10" height="8" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td align="right" width="50%" bgcolor="#CFDCED"><font color="#4C6C8F" size="3" face="Arial, Helvetica, Sans-serif">
                  &nbsp;
                  
                  </font><img width="10" height="8" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td width="10" bgcolor="#CFDCED"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td colspan="4" bgcolor="#294563"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <!--================= end middle NavBar ==================-->
  <!--================= start Content==================-->
  <tr>
  <td align="left" width="10"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td align="left" width="100%">
  <div class="content">
  <table class="title" summary="">
  <tr>
  <td valign="middle">
  <h1>Advanced Control Flow</h1>
  </td><script Language="Javascript">
  
  function printit(){  
  if (window.print) {
      window.print() ;  
  } else {
      var WebBrowser = '<OBJECT CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" HEIGHT="0" WIDTH="0" ID="WebBrowser1"></OBJECT>';
  document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
      WebBrowser1.ExecWB(6, 2);//Use a 1 vs. a 2 for a prompting dialog box    WebBrowser1.outerHTML = "";  
  }
  }
  </script><script Language="Javascript">  
  var NS = (navigator.appName == "Netscape");
  var VERSION = parseInt(navigator.appVersion);
  if (VERSION > 3) {
      document.write('<td nowrap="nowrap" width="40" align="center">');     
      document.write('  <a class="dida" href="javascript:printit()">');        
      document.write('    <img alt="Print this Page" src="../../skin/images/printer.gif" class="skin"><br>');   
      document.write('  print</a>');   
      document.write('</td>');           
  }
  </script><td nowrap="nowrap" width="40" align="center"><a class="dida" href="jxforms.pdf"><img alt="PDF" src="../../skin/images/pdfdoc.gif" class="skin"><br>
            PDF</a></td>
  </tr>
  </table>
  <p>
  <font size="-2">by&nbsp;Christopher Oliver</font>
  </p>
  <ul class="minitoc">
  <li>
  <a href="#JXForms">JXForms</a>
  <ul class="minitoc">
  <li>
  <a href="#Table+of+Contents">Table of Contents</a>
  </li>
  </ul>
  </li>
  <li>
  <a href="#Overview-N1005C">Overview</a>
  </li>
  <li>
  <a href="#Sitemap-N1009F">Sitemap</a>
  </li>
  <li>
  <a href="#Form+Controls">Form Controls</a>
  <ul class="minitoc">
  <li>
  <a href="#form">form</a>
  </li>
  <li>
  <a href="#error">error</a>
  </li>
  <li>
  <a href="#violations">violations</a>
  </li>
  <li>
  <a href="#violation">violation</a>
  </li>
  <li>
  <a href="#input">input</a>
  </li>
  <li>
  <a href="#secret">secret</a>
  </li>
  <li>
  <a href="#textarea">textarea</a>
  </li>
  <li>
  <a href="#output">output</a>
  </li>
  <li>
  <a href="#select">select</a>
  </li>
  <li>
  <a href="#select1">select1</a>
  </li>
  <li>
  <a href="#submit">submit</a>
  </li>
  <li>
  <a href="#group">group</a>
  </li>
  <li>
  <a href="#repeat">repeat</a>
  </li>
  <li>
  <a href="#itemset">itemset</a>
  </li>
  </ul>
  </li>
  <li>
  <a href="#JavaScript+API">JavaScript API</a>
  <ul class="minitoc">
  <li>
  <a href="#JXForm+Object">JXForm Object</a>
  </li>
  </ul>
  </li>
  <li>
  <a href="#Validation-N103DA">Validation</a>
  </li>
  <li>
  <a href="#Conversion+to+HTML">Conversion to HTML</a>
  </li>
  </ul>
    
  <a name="N10013"></a><a name="JXForms"></a>
  <h3>JXForms</h3>
  <div style="margin-left: 0 ; border: 2px">
  <p>
  <em>JX</em>Forms is a framework that uses Apache <a href="http://jakarta.apache.org/commons/jxpath"><em>JX</em>Path</a> to support <a href="http://www.w3.org/MarkUp/Forms/">W3C XForms</a>-based markup and automated server-side binding to 
     <a href="http://java.sun.com/products/javabeans/">JavaBeans</a>, 
     <a href="http://www.w3.org/DOM/">XML/DOM</a>, 
     <a href="http://www.jdom.org/">JDOM</a>,
     <a href="http://jakarta.apache.org/commons/beanutils/api/org/apache/commons/beanutils/DynaBean.html">DynaBeans</a>, and JavaScript objects.
      </p>
  <a name="N10037"></a><a name="Table+of+Contents"></a>
  <h4>Table of Contents</h4>
  <div style="margin-left: 0 ; border: 2px">
  <p>
  <a href="#Overview">Overview</a>
  </p>
  <p>
  <a href="#Sitemap">Sitemap</a>
  </p>
  <p>
  <a href="#Controls">Form Controls</a>
  </p>
  <p>
  <a href="#JSAPI">JavaScript API</a>
  </p>
  <p>
  <a href="#Validation">Validation</a>
  </p>
  <p>
  <a href="#HTML">Conversion to HTML</a>
  </p>
  </div>
  </div>
    
  <a name="N1005C"></a><a name="Overview-N1005C"></a>
  <h3>Overview</h3>
  <div style="margin-left: 0 ; border: 2px">
  <a name="Overview"></a>
  <p>W3C XForms defines a device-neutral, platform-independent set of
  form controls suitable for general-purpose use. JXForms supports a subset of these controls. The controls are
  bound to a <em>model</em> provided by your Flowscript via <a href="http://www.w3.org/TR/xpath">XPath</a> expressions, for example in this simple case using the <span class="codefrag">ref</span> attribute
  on the controls (note that we have
  intentionally defaulted the JXForms namespace prefix here):</p>
  <pre class="code">
  &lt;select1 ref="/method"&gt;
    &lt;label&gt;Select Payment Method&lt;/label&gt;
    &lt;item&gt;
      &lt;label&gt;Cash&lt;/label&gt;
  
      &lt;value&gt;cash&lt;/value&gt;
    &lt;/item&gt;
    &lt;item&gt;
      &lt;label&gt;Credit&lt;/label&gt;
      &lt;value&gt;cc&lt;/value&gt;
  
    &lt;/item&gt;
  &lt;/select1&gt;
  &lt;input ref="/number"&gt;
    &lt;label&gt;Credit Card Number&lt;/label&gt;
  &lt;/input&gt;
  &lt;input ref="/expiry"&gt;
    &lt;label&gt;Expiration Date&lt;/label&gt;
  
  &lt;/input&gt;
  &lt;submit id="submit" continuation="forward"&gt;
    &lt;label&gt;Submit&lt;/label&gt;
  &lt;/submit&gt;</pre>
  <p>
    In your Flow script you would supply an appropriate model, for example, like this:</p>
  <pre class="code">
        var model = {
           method: "cash",
           number: "",
           expiry: ""
        }
     </pre>
  <p>
     Since JXForms uses <a href="http://jakarta.apache.org/commons/jxpath">JXPath</a>, your model may consist of any objects that <a href="http://jakarta.apache.org/commons/jxpath">JXPath</a> supports.
     </p>
  <p>
     Use the <span class="codefrag">setModel()</span> function of the form to associate your model with the form. Then use the <span class="codefrag">sendView()</span> function of the form to display it.
    Upon submission of the form, the model will be automatically updated and you can take action in your script based on its values:
    </p>
  <pre class="code">
        var model = {
           method: "cash",
           number: "",
           expiry: ""
        }
        form.setModel(model);
        form.sendView("form.xml");  // like sendPageAndWait this call blocks 
                                    // until the form is submitted
  
        // process the form's values:
        if (model.method == "cash") {
            ...
        } else if (model.method == "credit") {
            ....
        } 
     </pre>
  <p> 
     JXForms also supports declarative <a href="#validation">validation</a> of form elements using Schematron, and automated <a href="#backNext">support</a> for back/forward navigation in multi-page forms using continuations.
     </p>
  </div>
  
   
  <a name="N100A2"></a><a name="Sitemap-N1009F"></a>
  <h3>Sitemap</h3>
  <div style="margin-left: 0 ; border: 2px">
  <a name="Sitemap"></a>
  <p>To use JXForms, you will need to add several elements to your Cocoon <a href="../concepts/sitemap.html">Sitemap</a>, namely the JXForms generator, and several XSLT stylesheets. To use the JXForms generator, add a generator entry to your Sitemap with the <span class="codefrag">src</span> attribute set to <span class="codefrag">org.apache.cocoon.generation.JXFormsGenerator</span>, for example like this:</p>
  <pre class="code">
  &lt;map:generators&gt;
    &lt;map:generator label="content,data" 
        logger="sitemap.generator.jxforms" name="jxforms" 
           src="org.apache.cocoon.generation.JXFormsGenerator"/&gt;
  &lt;/map:generators&gt;
   </pre>
  <p>To invoke your form use the Sitemap's <span class="codefrag">&lt;map:call&gt;</span> operation to invoke the <span class="codefrag">jxForm</span> Flowscript function, for example like this:</p>
  <pre class="code">
     &lt;map:match pattern="feedBackWizard"&gt;
       &lt;map:call function="jxForm"&gt;
          &lt;map:parameter name="function" value="{1}"/&gt;
          &lt;map:parameter name="id" value="form-feedback"/&gt;
          &lt;map:parameter name="validator-schema-namespace" value="http://www.ascc.net/xml/schematron"/&gt;
          &lt;map:parameter name="validator-schema" value="schematron/wizard-xmlform-sch-report.xml"/&gt;
       &lt;/map:call&gt;
     &lt;/map:match&gt;
  </pre>
  <p>
    
  </p>
  </div>  
   
  <a name="N100CD"></a><a name="Form+Controls"></a>
  <h3>Form Controls</h3>
  <div style="margin-left: 0 ; border: 2px">
  <a name="Controls"></a>
  <p>The JXForms tags are defined in the following namespace:</p>
  <pre class="code">http://apache.org/cocoon/jxforms/1.0</pre>
  <p>JXForms supports the following controls:</p>
  <a name="N100DF"></a><a name="form"></a>
  <h4>form</h4>
  <div style="margin-left: 0 ; border: 2px">
  <p>The JXForms <span class="codefrag">&lt;form&gt;</span> element represents the overall form. It also corresponds to a validation <em>phase</em> in your <a href="#Validation">validation</a> rules. It has no direct counterpart in W3C XForms.</p>
  <p>Example:</p>
  <pre class="code">
    &lt;xf:form id="form-feedback" view="userIdentity"&gt;
      &lt;xf:label&gt;Personal Information&lt;/xf:label&gt;
      &lt;error&gt;
        &lt;xf:violations class="error"/&gt;
      &lt;/error&gt;
      &lt;xf:input ref="/firstName"&gt;
        &lt;xf:label&gt;First Name&lt;/xf:label&gt;
        &lt;xf:violations class="error"/&gt;
      &lt;/xf:input&gt;
    &lt;/xf:form&gt;
        </pre>
  <p></p>
  <p>It supports the following attributes:</p>
  <ul>
     
  <li>
  <span class="codefrag">id</span>
  </li>
     
  <li>
  <span class="codefrag">view</span>
  </li>
   
  </ul>
  <p>
   The <span class="codefrag">id</span> attribute must match the <span class="codefrag">id</span> Sitemap parameter passed to the <span class="codefrag">jxForm</span> function in <span class="codefrag">&lt;map:call&gt;</span>. The <span class="codefrag">view</span> attribute must match the <span class="codefrag">id</span> of a <span class="codefrag">&lt;phase&gt;</span> element in your Schematron validation rules.
   </p>
  </div>
  <a name="N10122"></a><a name="error"></a>
  <h4>error</h4>
  <div style="margin-left: 0 ; border: 2px">
  <p>JXForms <span class="codefrag">&lt;error&gt;</span> has no counterpart in W3C XForms. If present under the <span class="codefrag">form</span> element it serves as a placeholder for validation error messages associated with the entire form.
   </p>
  </div>
  <a name="N10131"></a><a name="violations"></a>
  <h4>violations</h4>
  <div style="margin-left: 0 ; border: 2px">
  <p>JXForms <span class="codefrag">&lt;violations&gt;</span> element has no counterpart in W3C XForms.</p>
  <p>Example:</p>
  <pre class="code">
        
  </pre>
  <p></p>
  </div>
  <a name="N10147"></a><a name="violation"></a>
  <h4>violation</h4>
  <div style="margin-left: 0 ; border: 2px">
  <p>JXForms <span class="codefrag">&lt;violation&gt;</span> element has no counterpart in W3C XForms.</p>
  <p>Example:</p>
  <pre class="code">
        
  </pre>
  <p></p>
  </div>
  <a name="N1015D"></a><a name="input"></a>
  <h4>input</h4>
  <div style="margin-left: 0 ; border: 2px">
  <p>JXForms <span class="codefrag">&lt;input&gt;</span> is based on the W3C XForms <a href="http://www.w3.org/TR/xforms/slice8.html#ui-input">input</a> element. It allows the user to do free-form data entry.</p>
  <p>Example:</p>
  <pre class="code">
        
  </pre>
  <p></p>
  <p>It supports the following attributes:</p>
  <ul>
     
  <li>
  <span class="codefrag">ref</span>
  </li>
     
  <li>
  <span class="codefrag">appearance</span>
  </li>
     
  <li>
  <span class="codefrag">class</span>
  </li>
   
  </ul>
  <p></p>
  </div>
  <a name="N1018B"></a><a name="secret"></a>
  <h4>secret</h4>
  <div style="margin-left: 0 ; border: 2px">
  <p>JXForms <span class="codefrag">&lt;secret&gt;</span> is based on the W3C XForms <a href="http://www.w3.org/TR/xforms/slice8.html#ui-secret">secret</a> element. It is is used for entering information that is considered sensitive, and thus not echoed to a visual or aural display as it is being entered, e.g., password entry. </p>
  <p>Example:</p>
  <pre class="code">
        
  </pre>
  <p></p>
  <p>It supports the following attributes:</p>
  <ul>
     
  <li>
  <span class="codefrag">ref</span>
  </li>
     
  <li>
  <span class="codefrag">appearance</span>
  </li>
     
  <li>
  <span class="codefrag">class</span>
  </li>
   
  </ul>
  <p></p>
  </div>
  <a name="N101B9"></a><a name="textarea"></a>
  <h4>textarea</h4>
  <div style="margin-left: 0 ; border: 2px">
  <p>JXForms <span class="codefrag">&lt;textarea&gt;</span> is based on the W3C XForms <a href="http://www.w3.org/TR/xforms/slice8.html#ui-textarea">textarea</a> element. </p>
  <p>Example:</p>
  <pre class="code">
        
  </pre>
  <p></p>
  <p>It supports the following attributes:</p>
  <ul>
     
  <li>
  <span class="codefrag">ref</span>
  </li>
     
  <li>
  <span class="codefrag">appearance</span>
  </li>
   
  </ul>
  <p></p>
  </div>
  <a name="N101E3"></a><a name="output"></a>
  <h4>output</h4>
  <div style="margin-left: 0 ; border: 2px">
  <p>JXForms <span class="codefrag">&lt;output&gt;</span> is based on the W3C XForms <a href="http://www.w3.org/TR/xforms/slice8.html#ui-output">output</a> element. It is used to display values from the model, but provides no means to enter or modify those values.</p>
  <p>Example:</p>
  <pre class="code">
        
  </pre>
  <p></p>
  <p>It supports the following attributes:</p>
  <ul>
     
  <li>
  <span class="codefrag">ref</span>
  </li>
     
  <li>
  <span class="codefrag">value</span>
  </li>
     
  <li>
  <span class="codefrag">appearance</span>
  </li>
     
  <li>
  <span class="codefrag">class</span>
  </li>
   
  </ul>
  </div>
  <a name="N10213"></a><a name="select"></a>
  <h4>select</h4>
  <div style="margin-left: 0 ; border: 2px">
  <p>
      
  </p>
  <p>JXForms <span class="codefrag">&lt;select&gt;</span> is based on the W3C XForms <a href="http://www.w3.org/TR/xforms/slice8.html#ui-selectMany">select</a> element. </p>
  <p>Example:</p>
  <pre class="code">
        
  </pre>
  <p></p>
  <p>It supports the following attributes:</p>
  <ul>
     
  <li>
  <span class="codefrag">ref</span>
  </li>
     
  <li>
  <span class="codefrag">appearance</span>
  </li>
     
  <li>
  <span class="codefrag">class</span>
  </li>
   
  </ul>
  </div>
  <a name="N10242"></a><a name="select1"></a>
  <h4>select1</h4>
  <div style="margin-left: 0 ; border: 2px">
  <p>JXForms <span class="codefrag">&lt;select&gt;</span> is based on the W3C XForms <a href="http://www.w3.org/TR/xforms/slice8.html#ui-selectOne">select1</a> element. It supports the following attributes:</p>
  <ul>
     
  <li>
  <span class="codefrag">ref</span>
  </li>
     
  <li>
  <span class="codefrag">appearance</span>
  </li>
     
  <li>
  <span class="codefrag">class</span>
  </li>
   
  </ul>
  <p></p>
  </div>
  <a name="N10263"></a><a name="submit"></a>
  <h4>submit</h4>
  <div style="margin-left: 0 ; border: 2px">
  <p>JXForms <span class="codefrag">&lt;submit&gt;</span> differs from <a href="http://www.w3.org/TR/xforms/slice8.html#ui-submit">that</a> of W3C XForms. </p>
  <p>Example:</p>
  <pre class="code">
        
  </pre>
  <p></p>
  <p>It supports the following attributes:</p>
  <ul>
     
  <li>
  <span class="codefrag">id</span>
  </li>
     
  <li>
  <span class="codefrag">continuation</span>
  </li>
     
  <li>
  <span class="codefrag">class</span>
  </li>
   
  </ul>
  <p>
   
  </p>
  </div>
  <a name="N10292"></a><a name="group"></a>
  <h4>group</h4>
  <div style="margin-left: 0 ; border: 2px">
  <p>JXForms <span class="codefrag">&lt;group&gt;</span> is based on the W3C XForms <a href="http://www.w3.org/TR/xforms/slice9.html#ui-group">group</a> element.</p>
  <p>Example:</p>
  <pre class="code">
        
  </pre>
  <p></p>
  <p>It supports the following attributes:</p>
  <ul>
     
  <li>
  <span class="codefrag">ref</span>
  </li>
     
  <li>
  <span class="codefrag">class</span>
  </li>
   
  </ul>
  <p>
    The value of the <span class="codefrag">ref</span> attribute of a <span class="codefrag">&lt;group&gt;</span> is the context node for evaluting relative paths of the <span class="codefrag">ref</span> attributes of its sub-elements.
   </p>
  </div>
  <a name="N102C6"></a><a name="repeat"></a>
  <h4>repeat</h4>
  <div style="margin-left: 0 ; border: 2px">
  <p>JXForms <span class="codefrag">&lt;repeat&gt;</span> is based on the W3C XForms <a href="http://www.w3.org/TR/xforms/slice9.html#ui-repeat">repeat</a> element.</p>
  <p>Example:</p>
  <pre class="code">
        
  </pre>
  <p></p>
  <p> It supports the following attributes:</p>
  <ul>
     
  <li>
  <span class="codefrag">nodeset</span>
  </li>
   
  </ul>
  <p></p>
  </div>
  <a name="N102EC"></a><a name="itemset"></a>
  <h4>itemset</h4>
  <div style="margin-left: 0 ; border: 2px">
  <p>JXForms <span class="codefrag">&lt;itemset&gt;</span> is based on the W3C XForms <a href="http://www.w3.org/TR/xforms/slice9.html#ui-common-elements-itemset">itemset</a> element. It is used for the dynamic creation of selections within the <span class="codefrag">select</span> and <span class="codefrag">select1</span> elements.</p>
  <p>Example:</p>
  <pre class="code">
        
  </pre>
  <p></p>
  <p> It supports the following attributes:</p>
  <ul>
     
  <li>
  <span class="codefrag">nodeset</span>
  </li>
   
  </ul>
  <p></p>
  </div>
  </div>  
   
  <a name="N10319"></a><a name="JavaScript+API"></a>
  <h3>JavaScript API</h3>
  <div style="margin-left: 0 ; border: 2px">
  <a name="JSAPI"></a>
  <p>
    JXForms provides a JavaScript <span class="codefrag">JXForm</span> object that provides methods for you to manage your form's <em>model</em> and to invoke its associated <em>view</em> and any validation rules you've specified.
    </p>
  <p>
    To use JXForms in a Flowscript you must load <span class="codefrag">resource://org/apache/cocoon/components/flow/javascript/JXForm.js</span> into your script and define a function that takes one argument (the argument passed to your function will be a JavaScript representation of your form), for example like this:</p>
  <pre class="code">
  
      cocoon.load("resource://org/apache/cocoon/components/flow/javascript/JXForm.js");
  
      function myFormHandler(form) {
         ...
      }
    </pre>
  <p>
    
  </p>
  <a name="N1033A"></a><a name="JXForm+Object"></a>
  <h4>JXForm Object</h4>
  <div style="margin-left: 0 ; border: 2px">
  <p>
      The <span class="codefrag">JXForm</span> object passed to your function has the following properties and functions:</p>
  <a name="N10345"></a><a name="setModel-N10332"></a>
  <h5>setModel</h5>
  <div style="margin-left: 0 ; border: 2px">
  <a name="setModel"></a>
  <p>
        
  <em>Function</em> <span class="codefrag">setModel([Object] model)</span>
        
  </p>
  <p>Set the model object of this form. <span class="codefrag">model</span> may be any Java bean, JavaScript, DOM, or JDOM object.</p>
  </div>
  <a name="N1035C"></a><a name="getModel-N10349"></a>
  <h5>getModel</h5>
  <div style="margin-left: 0 ; border: 2px">
  <a name="getModel"></a>
  <p>
        
  <em>Function</em> <span class="codefrag">[Object] getModel()</span>
        
  </p>
  <p>Get the model object of this form.</p>
  </div>
  <a name="N10370"></a><a name="sendView-N1035D"></a>
  <h5>sendView</h5>
  <div style="margin-left: 0 ; border: 2px">
  <a name="sendView"></a>
  <p>
        
  <em>Function</em> <span class="codefrag">sendView([String] uri, [Function] validator)</span>
        
  </p>
  <p>
   Sends view to presentation pipeline and waits for subsequent submission.
   Automatically resends view if validation fails.
   Creates two continuations: one immediately before the page is sent 
   and one immediately after. These are used to implement automated support
   for back/forward navigation in the form. When you move forward in the
   form the second continuation is invoked. When you move back from the
   following page the first continuation is invoked.
  
        </p>
  </div>
  <a name="N10384"></a><a name="addViolation-N10371"></a>
  <h5>addViolation</h5>
  <div style="margin-left: 0 ; border: 2px">
  <a name="addViolation"></a>
  <p>
        
  <em>Function</em> <span class="codefrag">addViolation([String] xpath, [String] message)</span>
        
  </p>
  <p>Adds a violation to this form</p>
  </div>
  <a name="N10398"></a><a name="hasViolations-N10385"></a>
  <h5>hasViolations</h5>
  <div style="margin-left: 0 ; border: 2px">
  <a name="hasViolations"></a>
  <p>
        
  <em>Function</em> <span class="codefrag">[Boolean] hasViolations()</span>
        
  </p>
  <p>Does this form have violations?</p>
  </div>
  <a name="N103AC"></a><a name="getValue-N10399"></a>
  <h5>getValue</h5>
  <div style="margin-left: 0 ; border: 2px">
  <a name="getValue"></a>
  <p>
        
  <em>Function</em> <span class="codefrag">[Object] getValue([String] xpath)</span>
        
  </p>
  <p>Computes the value of an xpath expression against the model of this form</p>
  </div>
  <a name="N103C0"></a><a name="iterate-N103AD"></a>
  <h5>iterate</h5>
  <div style="margin-left: 0 ; border: 2px">
  <a name="iterate"></a>
  <p>
        
  <em>Function</em> <span class="codefrag">[java.util.Iterator] iterate([String] xpath)</span>
        
  </p>
  <p>Returns an iterator over a nodeset value of an xpath expression evaluated 
   against the model of this form</p>
  </div>
  <a name="N103D4"></a><a name="finish-N103C1"></a>
  <h5>finish</h5>
  <div style="margin-left: 0 ; border: 2px">
  <a name="finish"></a>
  <p>
        
  <em>Function</em> <span class="codefrag">finish([String] uri)</span>
        
  </p>
  <p>Forwards to <span class="codefrag">uri</span> and then releases all resources associated with this form.</p>
  </div>
  </div>
  </div>  
   
  <a name="N103ED"></a><a name="Validation-N103DA"></a>
  <h3>Validation</h3>
  <div style="margin-left: 0 ; border: 2px">
  <a name="Validation"></a>
  <p>
   JXForms provides declarative form validation using the <a href="http://www.ascc.net/xml/resource/schematron/Schematron2000.html">Schematron</a> assertion language. Since Schematron is also based on XPath, you use the same expressions to reference your model in your validation rules as in your forms. In addition, because JXForms implements Schematron using <a href="http://jakarta.apache.org/commons/jxpath">JXPath</a>, you can make assertions about Java and JavaScript objects in your validation rules as well as about XML documents.
   </p>
  </div>  
   
  <a name="N10400"></a><a name="Conversion+to+HTML"></a>
  <h3>Conversion to HTML</h3>
  <div style="margin-left: 0 ; border: 2px">
  <a name="HTML"></a>
  <p>For conversion of JXForms controls to XHTML, JXForms provides two XSLT stylesheets that must be applied to the output of JXFormsGenerator: <span class="codefrag">jxforms-default.xsl</span> and <span class="codefrag">jxforms2html.xsl</span>. The former performs formatting of validation error messages. The latter converts the result to XHTML.
   </p>
  </div>  
   
  </div>
  </td><td width="10"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <!--================= end Content==================-->
  </table>
  </td>
  </tr>
  </table>
  <!--================= end Menu, NavBar, Content ==================-->
  <!--================= start Footer ==================-->
  <table summary="footer" cellspacing="0" cellpadding="0" width="100%" border="0">
  <tr>
  <td colspan="2" height="1" bgcolor="#4C6C8F"><img height="1" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"><a href="../../skin/images/label.gif"></a><a href="../../skin/images/page.gif"></a><a href="../../skin/images/chapter.gif"></a><a href="../../skin/images/chapter_open.gif"></a><a href="../../skin/images/current.gif"></a><a href="../..//favicon.ico"></a></td>
  </tr>
  <tr>
  <td colspan="2" bgcolor="#CFDCED" class="copyright" align="center"><font size="2" face="Arial, Helvetica, Sans-Serif">Copyright &copy;
            1999-2003&nbsp;The Apache Software Foundation. All rights reserved.<script type="text/javascript" language="JavaScript"><!--
                document.write(" - "+"Last Published: " + document.lastModified);
              //  --></script></font></td>
  </tr>
  <tr>
  <td colspan="2" align="left" bgcolor="#CFDCED" class="logos"></td>
  </tr>
  </table>
  <!--================= end Footer ==================-->
  </body>
  </html>
  
  
  
  1.1                  cocoon-site/site/2.1/userdocs/flow/jxforms.pdf
  
  	<<Binary file>>
  
  
  1.1                  cocoon-site/site/2.1/userdocs/flow/jxtemplate.html
  
  Index: jxtemplate.html
  ===================================================================
  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  <html>
  <head>
  <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  <title>Advanced Control Flow</title>
  <link type="text/css" href="../../skin/page.css" rel="stylesheet">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
  <!--================= start Navigation Path ==================-->
  <table summary="navigation path" width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td nowrap="nowrap" valign="middle" bgcolor="#CFDCED" height="20"><img height="1" width="5" alt="" src="../../skin/images/spacer.gif" class="spacer"><!--===== breadcrumb trail (javascript-generated) ====--><font size="2" face="Arial, Helvetica, Sans-serif"><script src="../../skin/breadcrumbs.js" language="JavaScript" type="text/javascript"></script></font></td>
  </tr>
  <tr>
  <td bgcolor="#4C6C8F" height="2"><img height="2" width="2" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  </table>
  <!--================= end Navigation Path ==================-->
  <!--================= start Banner ==================-->
  <table summary="header with logos" width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <!--================= start Group Logo ==================-->
  <td bgcolor="#294563"><a href=""></a></td>
  <!--================= end Group Logo ==================-->
  <!--================= start Project Logo ==================--><td width="100%" align="center" bgcolor="#294563"><a href="http://cocoon.apache.org/"><img border="0" class="logoImage" alt="Apache Cocoon" src="../../images/project-logo.gif"></a></td>
  <!--================= end Project Logo ==================-->
  <!--================= start Search ==================--><td valign="top" rowspan="2" bgcolor="#294563">
  <form target="_blank" action="http://www.google.com/search" method="get">
  <table summary="search" border="0" cellspacing="0" cellpadding="0" bgcolor="#4C6C8F">
  <tr>
  <td colspan="3"><img height="10" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td><img height="1" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td nowrap="nowrap"><input value="cocoon.apache.org" name="sitesearch" type="hidden"><input size="15" name="q" id="query" type="text"><img height="1" width="5" alt="" src="../../skin/images/spacer.gif" class="spacer"><input name="Search" value="Search" type="submit">
  <br>
  <font face="Arial, Helvetica, Sans-serif" size="2" color="white">
                        the Apache Cocoon site
                        
                        
                      </font></td><td><img height="1" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td><img alt="" border="0" height="10" width="9" src="../../skin/images/search-left.gif"></td><td><img height="1" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td><img alt="" border="0" height="10" width="9" src="../../skin/images/search-right.gif"></td>
  </tr>
  </table>
  </form>
  </td>
  <!--================= start Search ==================--><td bgcolor="#294563"><img height="10" width="10" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td valign="bottom" bgcolor="#294563" colspan="2">
  <!--================= start Tabs ==================-->
  <div class="tab">
  <table summary="tab bar" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td width="6"><img alt="" height="8" width="6" src="../../skin/images/spacer.gif"></td><td valign="bottom">
  <table summary="selected tab" style="height: 1.8em" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td valign="top" width="5" bgcolor="#4C6C8F"><img height="5" width="5" alt="" src="../../skin/images/tabSel-left.gif"></td><td valign="middle" bgcolor="#4C6C8F"><font color="#ffffff" size="2" face="Arial, Helvetica, Sans-serif"><b><a href="../../index.html"><font color="#000000">Home</font></a></b></font></td><td valign="top" width="5" bgcolor="#4C6C8F"><img height="5" width="5" alt="" src="../../skin/images/tabSel-right.gif"></td>
  </tr>
  </table>
  </td>
  </tr>
  </table>
  </div>
  <!--================= end Tabs ==================-->
  </td><td bgcolor="#294563"><img alt="" width="1" height="1" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td bgcolor="#4C6C8F" colspan="4"><img width="1" height="10" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  </table>
  <!--================= end Banner ==================-->
  <!--================= start Menu, NavBar, Content ==================-->
  <table summary="page content" bgcolor="#ffffff" width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td valign="top">
  <table summary="menu" border="0" cellspacing="0" cellpadding="0">
  <tr>
  <!--================= start left top NavBar ==================-->
  <td rowspan="3" valign="top">
  <table summary="blue line" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td bgcolor="#294563"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td bgcolor="#CFDCED"><font color="#4C6C8F" size="4" face="Arial, Helvetica, Sans-serif">&nbsp;</font></td>
  </tr>
  <tr>
  <td bgcolor="#294563"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  </table>
  </td>
  <!--================= end left top NavBar ==================--><td bgcolor="#294563"><img width="1" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td valign="bottom" bgcolor="#4C6C8F"><img width="10" height="10" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td nowrap="nowrap" valign="top" bgcolor="#4C6C8F">
  <!--================= start Menu items ==================-->
  <div class="menu">
  <ul>
  <li>
  <font color="#CFDCED">Navigation</font>
  <ul>
      
  <li>
  <a href="../../index.html">Main</a>
  </li>
      
  <li>
  <a href="../index.html">User Documentation</a>
  </li>
    
  </ul>
  </li>
  <li>
  <font color="#CFDCED">Flowscript</font>
  <ul>
      
  <li>
  <a href="index.html">Introduction</a>
  </li>
      
  <li>
  <a href="continuations.html">Continuations</a>
  </li>
      
  <li>
  <a href="how-does-it-work.html">How does it work?</a>
  </li>
      
  <li>
  <a href="using.html">Usage</a>
  </li>
      
  <li>
  <a href="sitemap.html">Sitemap</a>
  </li>
      
  <li>
  <a href="api.html">JavaScript API</a>
  </li>
      
  <li>
  <a href="views.html">Views</a>
  </li>
      
  <li>
  <span class="sel"><font color="#ffcc00">JXTemplate</font></span>
  </li>
      
  <li>
  <a href="jpath.html">JPath</a>
  </li>
      
  <li>
  <a href="velocity.html">Velocity</a>
  </li> 
      
  <li>
  <a href="jxforms.html">JXForms</a>
  </li>
      
  <li>
  <a href="woody.html">Woody</a>
  </li>
    
  </ul>
  </li>
  </ul>
  </div>
  <!--================= end Menu items ==================-->
  </td><td valign="bottom" bgcolor="#4C6C8F"><img width="10" height="10" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td bgcolor="#294563"><img width="1" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td valign="bottom" align="left" colspan="2" rowspan="2" bgcolor="#4C6C8F"><img height="10" width="10" border="0" alt="" src="../../skin/images/menu-left.gif"></td><td bgcolor="#4C6C8F"><img height="10" width="10" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td valign="bottom" align="right" colspan="2" rowspan="2" bgcolor="#4C6C8F"><img height="10" width="10" border="0" alt="" src="../../skin/images/menu-right.gif"></td>
  </tr>
  <tr>
  <td height="1" bgcolor="#294563"><img width="1" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  </table>
  </td><td valign="top" width="100%">
  <table summary="content" width="100%" border="0" cellpadding="0" cellspacing="0">
  <!--================= start middle NavBar ==================-->
  <tr>
  <td colspan="4" bgcolor="#294563"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td align="left" width="10" bgcolor="#CFDCED"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td align="left" width="50%" bgcolor="#CFDCED"><font color="#4C6C8F" size="3" face="Arial, Helvetica, Sans-serif">
                  &nbsp;
                  
                  </font><img width="10" height="8" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td align="right" width="50%" bgcolor="#CFDCED"><font color="#4C6C8F" size="3" face="Arial, Helvetica, Sans-serif">
                  &nbsp;
                  
                  </font><img width="10" height="8" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td width="10" bgcolor="#CFDCED"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td colspan="4" bgcolor="#294563"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <!--================= end middle NavBar ==================-->
  <!--================= start Content==================-->
  <tr>
  <td align="left" width="10"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td align="left" width="100%">
  <div class="content">
  <table class="title" summary="">
  <tr>
  <td valign="middle">
  <h1>Advanced Control Flow</h1>
  </td><script Language="Javascript">
  
  function printit(){  
  if (window.print) {
      window.print() ;  
  } else {
      var WebBrowser = '<OBJECT CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" HEIGHT="0" WIDTH="0" ID="WebBrowser1"></OBJECT>';
  document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
      WebBrowser1.ExecWB(6, 2);//Use a 1 vs. a 2 for a prompting dialog box    WebBrowser1.outerHTML = "";  
  }
  }
  </script><script Language="Javascript">  
  var NS = (navigator.appName == "Netscape");
  var VERSION = parseInt(navigator.appVersion);
  if (VERSION > 3) {
      document.write('<td nowrap="nowrap" width="40" align="center">');     
      document.write('  <a class="dida" href="javascript:printit()">');        
      document.write('    <img alt="Print this Page" src="../../skin/images/printer.gif" class="skin"><br>');   
      document.write('  print</a>');   
      document.write('</td>');           
  }
  </script><td nowrap="nowrap" width="40" align="center"><a class="dida" href="jxtemplate.pdf"><img alt="PDF" src="../../skin/images/pdfdoc.gif" class="skin"><br>
            PDF</a></td>
  </tr>
  </table>
  <p>
  <font size="-2">by&nbsp;Christopher Oliver</font>
  </p>
  <ul class="minitoc">
  <li>
  <a href="#JXTemplate+Generator">JXTemplate Generator</a>
  </li>
  <li>
  <a href="#Expression+Languages">Expression Languages</a>
  </li>
  <li>
  <a href="#Tags">Tags</a>
  <ul class="minitoc">
  <li>
  <a href="#template">template</a>
  </li>
  <li>
  <a href="#import">import</a>
  </li>
  <li>
  <a href="#set">set</a>
  </li>
  <li>
  <a href="#if">if</a>
  </li>
  <li>
  <a href="#choose">choose</a>
  </li>
  <li>
  <a href="#out">out</a>
  </li>
  <li>
  <a href="#forEach">forEach</a>
  </li>
  <li>
  <a href="#macro">macro</a>
  </li>
  </ul>
  </li>
  </ul>
  	
  <a name="N10013"></a><a name="JXTemplate+Generator"></a>
  <h3>JXTemplate Generator</h3>
  <div style="margin-left: 0 ; border: 2px">
  <p>
  The JXTemplate Generator is a page template processor that allows you to inject data from Java and JavaScript objects passed by a Cocoon Flowscript into a Cocoon pipeline. It provides a set of tags (similar to the <a href="http://java.sun.com/products/jsp/jstl/">JSTL</a> core tags) that allow you to iterate over Java collections (and Java or JavaScript arrays) and to test for the presence of optional or alternate bean properties, as well as embedded expressions to specify conditions and to access the properties of objects. The <em>JX</em>Template Generator gets its name from the embedded expression languages it supports, namely <a href="http://jakarta.apache.org/commons/jxpath">Apache <em>JX</em>Path</a> and <a href="http://jakarta.apache.org/commons/jexl">Apache <em>J</em>e<em>X</em>l</a>. 
    </p>
  <p>To use the JXTemplate Generator, add a generator entry to your <a href="../concepts/sitemap.html">sitemap</a> with the <span class="codefrag">src</span> attribute set to <span class="codefrag">org.apache.cocoon.generation.JXTemplateGenerator</span>, for example like this:</p>
  <pre class="code">
  &lt;map:generators&gt;
    &lt;map:generator label="content,data" 
        logger="sitemap.generator.jx" name="jx" 
           src="org.apache.cocoon.generation.JXTemplateGenerator"/&gt;
  &lt;/map:generators&gt;
  </pre>
  </div>
           
  <a name="N10046"></a><a name="Expression+Languages"></a>
  <h3>Expression Languages</h3>
  <div style="margin-left: 0 ; border: 2px">
  <p>
  The JXTemplate Generator supports two embedded expression languages: <a href="http://jakarta.apache.org/commons/jexl">Jexl</a> and <a href="http://jakarta.apache.org/commons/jxpath">JXPath</a>. Apache <a href="http://jakarta.apache.org/commons/jexl">Jexl</a> provides an extended version of the expression language of the <a href="http://java.sun.com/webservices/docs/1.0/tutorial/doc/JSTL.html">JSTL</a>. Apache <a href="http://jakarta.apache.org/commons/jxpath">JXPath</a> provides an interpreter of the <a href="http://www.w3.org/TR/xpath">XPath</a> expression language that can apply XPath expressions to graphs of Java objects of all kinds: JavaBeans, Maps, Servlet contexts, DOM etc, including mixtures thereof.
   </p>
  <p>
   Having an embedded expression language allows a page author to access an object using a simple syntax such as
   </p>
  <pre class="code">
   &lt;site signOn="${accountForm.signOn}"&gt;
   </pre>
  <p>Embedded Jexl expressions are contained in <span class="codefrag">${}</span>.</p>
  <p>Embedded JXPath expressions are contained in <span class="codefrag">#{}</span>.</p>
  <p>The referenced objects may be Java Beans, DOM, JDOM, or JavaScript objects 
  from a Flowscript. In addition the following implicit objects are available as
  both JXPath and Jexl variables in a template:</p>
  <dl>
  
  <dt>
  <a href="../../apidocs/java/org/apache/cocoon/environment/Request.html"><span class="codefrag">org.apache.cocoon.environment.Request</span></a><span class="codefrag"> request</span>
  </dt>
  
  <dd>
  <br>The current Cocoon request<br>
  </dd>
   
  
  <dt>
  <br>
  <a href="../../apidocs/java/org/apache/cocoon/environment/Response.html"><span class="codefrag">org.apache.cocoon.environment.Response</span></a><span class="codefrag"> response</span>
  </dt>
  
  <dd>
  <br>The Cocoon response associated with the current request<br>
  </dd>
   
  
  <dt>
  <br>
  <a href="../../apidocs/java/org/apache/cocoon/environment/Session.html"><span class="codefrag">org.apache.cocoon.environment.Session</span></a><span class="codefrag"> session</span>
  </dt>
  
  <dd>
  <br>The Cocoon session associated with the current request<br>
  </dd>
   
  
  <dt>
  <br>
  <a href="../../apidocs/java/org/apache/cocoon/environment/Context.html"><span class="codefrag">org.apache.cocoon.environment.Context</span></a><span class="codefrag"> context</span>
  </dt>
  
  <dd>
  <br>The Cocoon context associated with the current request<br>
  </dd>
   
  
  <dt>
  <br>
  <span class="codefrag">org.apache.avalon.framework.parameter.Parameter[]</span><span class="codefrag"> parameters</span>
  </dt>
  
  <dd>
  <br>Any parameters passed to the generator in the pipeline<br>
  </dd>
  
  </dl>
  <p>
  Jexl Example:</p>
  <pre class="code">
    The content type of the current request is ${request.contentType}
  </pre>
  <p>
  JXPath Example:</p>
  <pre class="code">
    The content type of the current request is #{$request/contentType}
  </pre>
  <p> 
  The current Web Continuation from the Flowscript 
  is also available as a variable named <span class="codefrag">continuation</span>. You would 
  typically access its <span class="codefrag">id</span>:</p>
  <pre class="code">
     &lt;form action="${continuation.id}"&gt;
  </pre>
  <p>You can also reach previous continuations by using the <span class="codefrag">getParent()</span> function:</p>
  <pre class="code">
      &lt;form action="${continuation.getParent().id}" &gt;
  </pre>
  <p>or using an XPath expression:</p>
  <pre class="code">
      &lt;form action="#{getParent($continuation)/id}" &gt;
  </pre>
  </div>
  
  <a name="N100F5"></a><a name="Tags"></a>
  <h3>Tags</h3>
  <div style="margin-left: 0 ; border: 2px">
  <p>The JXTemplate Generator tags are defined in the namespace</p>
  <pre class="code">
  http://apache.org/cocoon/templates/jx/1.0
  </pre>
  <a name="N10102"></a><a name="template"></a>
  <h4>template</h4>
  <div style="margin-left: 0 ; border: 2px">
  <p>The <span class="codefrag">template</span> tag defines a new template:</p>
  <pre class="code">
     &lt;t:template xmlns:t="http://apache.org/cocoon/templates/jx/1.0"&gt;
         body
     &lt;/t:template&gt;
  </pre>
  </div>
  <a name="N10112"></a><a name="import"></a>
  <h4>import</h4>
  <div style="margin-left: 0 ; border: 2px"></div>
  <p>The <span class="codefrag">import</span> tag allows you to include another template within the current template. The content of the imported template is compiled and will be executed in place of the <span class="codefrag">import</span> tag:</p>
  <pre class="code">
     &lt;import uri="URI" [context="Expression"]/&gt;
  </pre>
  <p>The Cocoon source resolver is used to resolve <span class="codefrag">uri</span>. If <span class="codefrag">context</span> is present, then its value is used as the context for evaluating the imported template, otherwise the current context is used.</p>
  <a name="N1012C"></a><a name="set"></a>
  <h4>set</h4>
  <div style="margin-left: 0 ; border: 2px">
  <p>The <span class="codefrag">set</span> tag creates a local alias of an object. The <span class="codefrag">var</span> attribute specifies the name of a variable to assign the object to. The <span class="codefrag">value</span> attribute specifies the object (defaults to <span class="codefrag">body</span> if not present):</p>
  <pre class="code">
     &lt;set var="Name" [value="Value"]&gt;
         [body]
     &lt;/set&gt;
  </pre>
  <p>If used within a <span class="codefrag">macro</span> definition (see below) variables created by <span class="codefrag">set</span> are only visible within the body of the <span class="codefrag">macro</span>.</p>
  <p>Jexl Example:</p>
  <pre class="code">
  &lt;set var="greeting" value="Hello ${user}"/&gt;
  The value of greeting is ${greeting}
  </pre>
  <p>JXPath Example:</p>
  <pre class="code">
  &lt;set var="greeting" value="Hello #{user}"/&gt;
  The value of greeting is #{$greeting}
  </pre>
  </div>
  <a name="N10160"></a><a name="if"></a>
  <h4>if</h4>
  <div style="margin-left: 0 ; border: 2px">
  <p>The <span class="codefrag">if</span> tag allows the conditional execution of its body 
  according to value of its <span class="codefrag">test</span> attribute:</p>
  <pre class="code">
    &lt;if test="Expression"&gt;
        body
    &lt;/if&gt;
  </pre>
  <p>Jexl Example:</p>
  <pre class="code">
  &lt;if test="${cart.numberOfItems == 0}"&gt;
    Your cart is empty
  &lt;/if&gt;
  </pre>
  <p>JXPath Example:</p>
  <pre class="code">
  &lt;if test="#{cart/numberOfItems = 0}"&gt;
    Your cart is empty
  &lt;/if&gt;
  </pre>
  </div>
  <a name="N10184"></a><a name="choose"></a>
  <h4>choose</h4>
  <div style="margin-left: 0 ; border: 2px">
  <p>The <span class="codefrag">choose</span> tag performs conditional block execution by its 
  embedded <span class="codefrag">when</span> sub tags. It renders the body of the first 
  <span class="codefrag">when</span> tag whose <span class="codefrag">test</span> condition evaluates to true. 
  If none of the <span class="codefrag">test</span> conditions of its nested <span class="codefrag">when</span> tags
  evaluate to <span class="codefrag">true</span>, then the body of its <span class="codefrag">otherwise</span> 
  tag is evaluated, if present:</p>
  <pre class="code">
   &lt;choose&gt;
     &lt;when test="Expression"&gt;
        body
     &lt;/when&gt;+
     &lt;otherwise&gt;
        body
     &lt;/otherwise&gt;?
   &lt;/choose&gt;
  </pre>
  <p>Jexl Example:</p>
  <pre class="code">
  &lt;choose&gt;
    &lt;when test="${!user.loggedIn}"&gt;
      &lt;set var="label" value="Log in"&gt;
    &lt;/when&gt;
    &lt;otherwise&gt;
      &lt;set var="label" value="Log out"&gt;
    &lt;/otherwise&gt;
  &lt;/choose&gt;
  </pre>
  <p>JXPath Example:</p>
  <pre class="code">
  &lt;choose&gt;
    &lt;when test="#{not(user/loggedIn)}"&gt;
      &lt;set var="label" value="Log in"&gt;
    &lt;/when&gt;
    &lt;otherwise&gt;
      &lt;set var="label" value="Log out"&gt;
    &lt;/otherwise&gt;
  &lt;/choose&gt;
  </pre>
  </div>
  <a name="N101BA"></a><a name="out"></a>
  <h4>out</h4>
  <div style="margin-left: 0 ; border: 2px">
  <p>The <span class="codefrag">out</span> tag evaluates an expression and outputs 
  the result of the evaluation:</p>
  <pre class="code">
  &lt;out value="Expression"/&gt;
  </pre>
  <p>Jexl Example:</p>
  <pre class="code">
  &lt;out value="${cart.numberOfItems}"&gt;
  </pre>
  <p>JXPath Example:</p>
  <pre class="code">
  &lt;out value="#{cart/numberOfItems}"&gt;
  </pre>
  </div>
  <a name="N101DB"></a><a name="forEach"></a>
  <h4>forEach</h4>
  <div style="margin-left: 0 ; border: 2px">
  <p>The <span class="codefrag">forEach</span> tag allows you to iterate over a collection 
  of objects:</p>
  <pre class="code">
    &lt;forEach [var="Name"] [items="Expression"] [begin="NumExpr"] [end="NumExpr"] [step="NumExpr"]&gt;
      body
   &lt;/forEach&gt;
  </pre>
  <p>The <span class="codefrag">items</span> attribute specifies the list of items to iterate over. The <span class="codefrag">var</span> attribute specifies the name of a variable to hold the current item. The <span class="codefrag">begin</span> attribute specifies the element to start with 
  (<span class="codefrag">0</span> = first item, <span class="codefrag">1</span> = second item, ...). 
  If unspecified it defaults to <span class="codefrag">0</span>. The <span class="codefrag">end</span> 
  attribute specifies the item to end with (<span class="codefrag">0</span> = first item, 
  <span class="codefrag">1</span> = second item, ...). If unspecified it defaults to the last item in the list. Every <span class="codefrag">step</span> items are
  processed (defaults to <span class="codefrag">1</span> if <span class="codefrag">step</span> is absent). Either <span class="codefrag">items</span> or both <span class="codefrag">begin</span> and <span class="codefrag">end</span> must be present.</p>
  <p>An alternate form of <span class="codefrag">forEach</span> is supported for convenience when using XPath (since you can specify the selection criteria for the collection using XPath itself):</p>
  <pre class="code">
  &lt;forEach select="XPathExpression"&gt;
    body
  &lt;/forEach&gt;
  </pre>
  <p>When using XPath expressions within <span class="codefrag">forEach</span> the current element is the context node and can be referenced with: 
  <span class="codefrag">#{.}</span>
  </p>
  <p>Jexl Example:</p>
  <pre class="code">
  &lt;forEach var="item" items="${cart.cartItems} begin="${start}" end="${count-start}" step="1""&gt;
     &lt;td&gt;${item.productId}&lt;/td&gt;
  &lt;/forEach&gt;
  </pre>
  <p>JXPath Example:</p>
  <pre class="code">
  &lt;forEach select="#{cart/cartItems[position() &amp;lt;= $count]}}&gt;
     &lt;td&gt;#{./productId}&lt;/td&gt;
  &lt;/forEach&gt;
  </pre>
  </div>
  <a name="N1023F"></a><a name="macro"></a>
  <h4>macro</h4>
  <div style="margin-left: 0 ; border: 2px">
  <p>The <span class="codefrag">macro</span> tag allows you define a new custom tag.</p>
  <pre class="code">
  &lt;macro name="Name" [targetNamespace="Namespace"]&gt;
    &lt;parameter name="Name" [optional="Boolean"] [default="Value"]/&gt;*
    body
  
  &lt;/macro&gt;
  </pre>
  <p> For example:</p>
  <pre class="code">
  &lt;c:macro name="d"&gt;
    &lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
  &lt;/c:macro&gt;
  </pre>
  <p>The tag being defined in this example is <span class="codefrag">&lt;d&gt;</span> and it 
  can be used like any other tag:</p>
  <pre class="code">
    &lt;d/&gt;
  </pre>
  <p>However, when this tag is used it will be replaced with a row containing a single empty data cell.</p>
  <p> When such a tag is used, the attributes and content of the tag become available as variables in the body of the <span class="codefrag">macro</span>'s definition, for example:</p>
  <pre class="code">
  &lt;c:macro name="tablerows"&gt;
    &lt;c:parameter name="list"/&gt;
    &lt;c:parameter name="color"/&gt;
    &lt;c:forEach var="item" items="${list}"&gt;
      &lt;tr&gt;&lt;td bgcolor="${color}"&gt;${item}&lt;/td&gt;&lt;/tr&gt;
    &lt;/c:forEach&gt;
  &lt;/c:macro&gt;
  </pre>
  <p>The <span class="codefrag">parameter</span> tags in the macro definition define formal parameters, which are replaced with the actual attribute values of the tag when it is used. The content of the tag is also available as a special variable <span class="codefrag">${content}</span>.</p>
  <p>Assuming you had this code in your flowscript:</p>
  <pre class="code">var greatlakes = ["Superior", "Michigan", "Huron", "Erie", "Ontario"];
     sendPage(uri, {greatlakes: greatlakes});</pre>
  <p>and a template like this:</p>
  <pre class="code">
  &lt;table&gt;
     &lt;tablerows list="${greatlakes}" color="blue"/&gt;
  &lt;/table&gt;
  </pre>
  <p>When the <span class="codefrag">tablerows</span> tag is used in this situation the following output would be generated:
  </p>
  <pre class="code">
  &lt;table&gt;
    &lt;tr&gt;&lt;td bgcolor="blue"&gt;Superior&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td bgcolor="blue"&gt;Michigan&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td bgcolor="blue"&gt;Huron&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td bgcolor="blue"&gt;Erie&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td bgcolor="blue"&gt;Ontario&lt;/td&gt;&lt;/tr&gt;
  &lt;/table&gt;
  </pre>
  </div>
  </div>
  
  </div>
  </td><td width="10"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <!--================= end Content==================-->
  </table>
  </td>
  </tr>
  </table>
  <!--================= end Menu, NavBar, Content ==================-->
  <!--================= start Footer ==================-->
  <table summary="footer" cellspacing="0" cellpadding="0" width="100%" border="0">
  <tr>
  <td colspan="2" height="1" bgcolor="#4C6C8F"><img height="1" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"><a href="../../skin/images/label.gif"></a><a href="../../skin/images/page.gif"></a><a href="../../skin/images/chapter.gif"></a><a href="../../skin/images/chapter_open.gif"></a><a href="../../skin/images/current.gif"></a><a href="../..//favicon.ico"></a></td>
  </tr>
  <tr>
  <td colspan="2" bgcolor="#CFDCED" class="copyright" align="center"><font size="2" face="Arial, Helvetica, Sans-Serif">Copyright &copy;
            1999-2003&nbsp;The Apache Software Foundation. All rights reserved.<script type="text/javascript" language="JavaScript"><!--
                document.write(" - "+"Last Published: " + document.lastModified);
              //  --></script></font></td>
  </tr>
  <tr>
  <td colspan="2" align="left" bgcolor="#CFDCED" class="logos"></td>
  </tr>
  </table>
  <!--================= end Footer ==================-->
  </body>
  </html>
  
  
  
  1.1                  cocoon-site/site/2.1/userdocs/flow/jxtemplate.pdf
  
  	<<Binary file>>
  
  
  1.1                  cocoon-site/site/2.1/userdocs/flow/sitemap.html
  
  Index: sitemap.html
  ===================================================================
  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  <html>
  <head>
  <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  <title>Advanced Control Flow</title>
  <link type="text/css" href="../../skin/page.css" rel="stylesheet">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
  <!--================= start Navigation Path ==================-->
  <table summary="navigation path" width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td nowrap="nowrap" valign="middle" bgcolor="#CFDCED" height="20"><img height="1" width="5" alt="" src="../../skin/images/spacer.gif" class="spacer"><!--===== breadcrumb trail (javascript-generated) ====--><font size="2" face="Arial, Helvetica, Sans-serif"><script src="../../skin/breadcrumbs.js" language="JavaScript" type="text/javascript"></script></font></td>
  </tr>
  <tr>
  <td bgcolor="#4C6C8F" height="2"><img height="2" width="2" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  </table>
  <!--================= end Navigation Path ==================-->
  <!--================= start Banner ==================-->
  <table summary="header with logos" width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <!--================= start Group Logo ==================-->
  <td bgcolor="#294563"><a href=""></a></td>
  <!--================= end Group Logo ==================-->
  <!--================= start Project Logo ==================--><td width="100%" align="center" bgcolor="#294563"><a href="http://cocoon.apache.org/"><img border="0" class="logoImage" alt="Apache Cocoon" src="../../images/project-logo.gif"></a></td>
  <!--================= end Project Logo ==================-->
  <!--================= start Search ==================--><td valign="top" rowspan="2" bgcolor="#294563">
  <form target="_blank" action="http://www.google.com/search" method="get">
  <table summary="search" border="0" cellspacing="0" cellpadding="0" bgcolor="#4C6C8F">
  <tr>
  <td colspan="3"><img height="10" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td><img height="1" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td nowrap="nowrap"><input value="cocoon.apache.org" name="sitesearch" type="hidden"><input size="15" name="q" id="query" type="text"><img height="1" width="5" alt="" src="../../skin/images/spacer.gif" class="spacer"><input name="Search" value="Search" type="submit">
  <br>
  <font face="Arial, Helvetica, Sans-serif" size="2" color="white">
                        the Apache Cocoon site
                        
                        
                      </font></td><td><img height="1" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td><img alt="" border="0" height="10" width="9" src="../../skin/images/search-left.gif"></td><td><img height="1" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td><img alt="" border="0" height="10" width="9" src="../../skin/images/search-right.gif"></td>
  </tr>
  </table>
  </form>
  </td>
  <!--================= start Search ==================--><td bgcolor="#294563"><img height="10" width="10" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td valign="bottom" bgcolor="#294563" colspan="2">
  <!--================= start Tabs ==================-->
  <div class="tab">
  <table summary="tab bar" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td width="6"><img alt="" height="8" width="6" src="../../skin/images/spacer.gif"></td><td valign="bottom">
  <table summary="selected tab" style="height: 1.8em" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td valign="top" width="5" bgcolor="#4C6C8F"><img height="5" width="5" alt="" src="../../skin/images/tabSel-left.gif"></td><td valign="middle" bgcolor="#4C6C8F"><font color="#ffffff" size="2" face="Arial, Helvetica, Sans-serif"><b><a href="../../index.html"><font color="#000000">Home</font></a></b></font></td><td valign="top" width="5" bgcolor="#4C6C8F"><img height="5" width="5" alt="" src="../../skin/images/tabSel-right.gif"></td>
  </tr>
  </table>
  </td>
  </tr>
  </table>
  </div>
  <!--================= end Tabs ==================-->
  </td><td bgcolor="#294563"><img alt="" width="1" height="1" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td bgcolor="#4C6C8F" colspan="4"><img width="1" height="10" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  </table>
  <!--================= end Banner ==================-->
  <!--================= start Menu, NavBar, Content ==================-->
  <table summary="page content" bgcolor="#ffffff" width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td valign="top">
  <table summary="menu" border="0" cellspacing="0" cellpadding="0">
  <tr>
  <!--================= start left top NavBar ==================-->
  <td rowspan="3" valign="top">
  <table summary="blue line" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td bgcolor="#294563"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td bgcolor="#CFDCED"><font color="#4C6C8F" size="4" face="Arial, Helvetica, Sans-serif">&nbsp;</font></td>
  </tr>
  <tr>
  <td bgcolor="#294563"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  </table>
  </td>
  <!--================= end left top NavBar ==================--><td bgcolor="#294563"><img width="1" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td valign="bottom" bgcolor="#4C6C8F"><img width="10" height="10" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td nowrap="nowrap" valign="top" bgcolor="#4C6C8F">
  <!--================= start Menu items ==================-->
  <div class="menu">
  <ul>
  <li>
  <font color="#CFDCED">Navigation</font>
  <ul>
      
  <li>
  <a href="../../index.html">Main</a>
  </li>
      
  <li>
  <a href="../index.html">User Documentation</a>
  </li>
    
  </ul>
  </li>
  <li>
  <font color="#CFDCED">Flowscript</font>
  <ul>
      
  <li>
  <a href="index.html">Introduction</a>
  </li>
      
  <li>
  <a href="continuations.html">Continuations</a>
  </li>
      
  <li>
  <a href="how-does-it-work.html">How does it work?</a>
  </li>
      
  <li>
  <a href="using.html">Usage</a>
  </li>
      
  <li>
  <span class="sel"><font color="#ffcc00">Sitemap</font></span>
  </li>
      
  <li>
  <a href="api.html">JavaScript API</a>
  </li>
      
  <li>
  <a href="views.html">Views</a>
  </li>
      
  <li>
  <a href="jxtemplate.html">JXTemplate</a>
  </li>
      
  <li>
  <a href="jpath.html">JPath</a>
  </li>
      
  <li>
  <a href="velocity.html">Velocity</a>
  </li> 
      
  <li>
  <a href="jxforms.html">JXForms</a>
  </li>
      
  <li>
  <a href="woody.html">Woody</a>
  </li>
    
  </ul>
  </li>
  </ul>
  </div>
  <!--================= end Menu items ==================-->
  </td><td valign="bottom" bgcolor="#4C6C8F"><img width="10" height="10" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td bgcolor="#294563"><img width="1" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td valign="bottom" align="left" colspan="2" rowspan="2" bgcolor="#4C6C8F"><img height="10" width="10" border="0" alt="" src="../../skin/images/menu-left.gif"></td><td bgcolor="#4C6C8F"><img height="10" width="10" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td valign="bottom" align="right" colspan="2" rowspan="2" bgcolor="#4C6C8F"><img height="10" width="10" border="0" alt="" src="../../skin/images/menu-right.gif"></td>
  </tr>
  <tr>
  <td height="1" bgcolor="#294563"><img width="1" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  </table>
  </td><td valign="top" width="100%">
  <table summary="content" width="100%" border="0" cellpadding="0" cellspacing="0">
  <!--================= start middle NavBar ==================-->
  <tr>
  <td colspan="4" bgcolor="#294563"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td align="left" width="10" bgcolor="#CFDCED"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td align="left" width="50%" bgcolor="#CFDCED"><font color="#4C6C8F" size="3" face="Arial, Helvetica, Sans-serif">
                  &nbsp;
                  
                  </font><img width="10" height="8" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td align="right" width="50%" bgcolor="#CFDCED"><font color="#4C6C8F" size="3" face="Arial, Helvetica, Sans-serif">
                  &nbsp;
                  
                  </font><img width="10" height="8" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td width="10" bgcolor="#CFDCED"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td colspan="4" bgcolor="#294563"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <!--================= end middle NavBar ==================-->
  <!--================= start Content==================-->
  <tr>
  <td align="left" width="10"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td align="left" width="100%">
  <div class="content">
  <table class="title" summary="">
  <tr>
  <td valign="middle">
  <h1>Advanced Control Flow</h1>
  </td><script Language="Javascript">
  
  function printit(){  
  if (window.print) {
      window.print() ;  
  } else {
      var WebBrowser = '<OBJECT CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" HEIGHT="0" WIDTH="0" ID="WebBrowser1"></OBJECT>';
  document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
      WebBrowser1.ExecWB(6, 2);//Use a 1 vs. a 2 for a prompting dialog box    WebBrowser1.outerHTML = "";  
  }
  }
  </script><script Language="Javascript">  
  var NS = (navigator.appName == "Netscape");
  var VERSION = parseInt(navigator.appVersion);
  if (VERSION > 3) {
      document.write('<td nowrap="nowrap" width="40" align="center">');     
      document.write('  <a class="dida" href="javascript:printit()">');        
      document.write('    <img alt="Print this Page" src="../../skin/images/printer.gif" class="skin"><br>');   
      document.write('  print</a>');   
      document.write('</td>');           
  }
  </script><td nowrap="nowrap" width="40" align="center"><a class="dida" href="sitemap.pdf"><img alt="PDF" src="../../skin/images/pdfdoc.gif" class="skin"><br>
            PDF</a></td>
  </tr>
  </table>
  <p>
  <font size="-2">by&nbsp;Ovidiu Predescu,&nbsp;Christopher Oliver</font>
  </p>
  <ul class="minitoc">
  <li>
  <a href="#Sitemap">Sitemap</a>
  <ul class="minitoc">
  <li>
  <a href="#flow">flow</a>
  </li>
  <li>
  <a href="#call">call</a>
  </li>
  </ul>
  </li>
  </ul>
      
  <a name="N10017"></a><a name="Sitemap"></a>
  <h3>Sitemap</h3>
  <div style="margin-left: 0 ; border: 2px">
  <p>The Cocoon <a href="../concepts/sitemap.html">Sitemap</a> provides two elements to specify interactions with your Flowscripts.</p>
  <a name="N10023"></a><a name="flow"></a>
  <h4>flow</h4>
  <div style="margin-left: 0 ; border: 2px">
  <p>The <span class="codefrag">flow</span> element defines a Flowscript interpreter for a sitemap. The <span class="codefrag">language</span> attribute specifies the target programming language. Currently the only supported language is <span class="codefrag">"javascript"</span>. Its embedded <span class="codefrag">script</span> elements allow you to specify the files that make up the flow for this sitemap. Each <span class="codefrag">script</span> element specifies the URI of a script that will be compiled and executed when this Sitemap is created. The <span class="codefrag">src</span> attribute specifies the URI of the script.</p>
  <pre class="code">
          &lt;map:flow language="Language"&gt;
             &lt;map:script src="URI"/&gt;+
          &lt;/map:flow&gt;
        </pre>
  <p>Example:</p>
  <pre class="code">
          &lt;map:flow language="javascript"&gt;
             &lt;map:script src="myApplication.js"/&gt;
          &lt;/map:flow&gt;
        </pre>
  </div>
  <a name="N1004B"></a><a name="call"></a>
  <h4>call</h4>
  <div style="margin-left: 0 ; border: 2px">
  <p>The <span class="codefrag">call</span> element allows you to call a top-level function in your Flowscript or to invoke an existing continuation.</p>
  <a name="N10056"></a><a name="function"></a>
  <h5>function</h5>
  <div style="margin-left: 0 ; border: 2px">
  <a name="callFunction"></a>
  <p>If the <span class="codefrag">function</span> attribute is present, then the Sitemap will invoke a top-level function defined in your Flowscript. The <span class="codefrag">function</span> attribute specifies the name of the function. Zero or more nested <span class="codefrag">parameter</span> elements may be provided to pass arguments to the function.</p>
  <pre class="code">
          &lt;map:call function="FunctionName"&gt;
             &lt;map:parameter name="Name" value="Value"/&gt;*
          &lt;/map:call&gt;
        </pre>
  <p>Example:</p>
  <pre class="code">
          &lt;map:flow language="javascript"&gt;
             &lt;map:script src="myApplication.js"/&gt;
          &lt;/map:flow&gt;
          &lt;map:pipelines&gt;
             &lt;map:pipeline&gt;
                &lt;map:match pattern="index.html"&gt;
                   &lt;map:call function="showIndexPage"/&gt;
                &lt;/map:match&gt;
             &lt;/map:pipeline&gt;
          &lt;/map:pipelines&gt;
        </pre>
  <p>Then in <span class="codefrag">myApplication.js</span> you would define a JavaScript function called <span class="codefrag">showIndexPage()</span> such as:</p>
  <pre class="code">
          function showIndexPage() { 
              var param = cocoon.request.get("paramName");
              sendPage("private/index.html", {param: param});
          }
        </pre>
  </div>
  <a name="N10085"></a><a name="continuation"></a>
  <h5>continuation</h5>
  <div style="margin-left: 0 ; border: 2px">
  <a name="callContinuation"></a>
  <p>If the <span class="codefrag">continuation</span> attribute is present, then the Sitemap will invoke an existing continuation of your Flowscript. The <span class="codefrag">continuation</span> attribute specifies the unique id of the continuation.</p>
  <pre class="code">
          &lt;map:call continuation="Id"/&gt;
        </pre>
  <p>Example:</p>
  <pre class="code">
          &lt;map:match pattern="*.form"&gt;
            &lt;map:call continuation="{1}"/&gt;
          &lt;/map:match&gt;
        </pre>
  </div>
  </div>
  </div>
  
    
  </div>
  </td><td width="10"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <!--================= end Content==================-->
  </table>
  </td>
  </tr>
  </table>
  <!--================= end Menu, NavBar, Content ==================-->
  <!--================= start Footer ==================-->
  <table summary="footer" cellspacing="0" cellpadding="0" width="100%" border="0">
  <tr>
  <td colspan="2" height="1" bgcolor="#4C6C8F"><img height="1" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"><a href="../../skin/images/label.gif"></a><a href="../../skin/images/page.gif"></a><a href="../../skin/images/chapter.gif"></a><a href="../../skin/images/chapter_open.gif"></a><a href="../../skin/images/current.gif"></a><a href="../..//favicon.ico"></a></td>
  </tr>
  <tr>
  <td colspan="2" bgcolor="#CFDCED" class="copyright" align="center"><font size="2" face="Arial, Helvetica, Sans-Serif">Copyright &copy;
            1999-2003&nbsp;The Apache Software Foundation. All rights reserved.<script type="text/javascript" language="JavaScript"><!--
                document.write(" - "+"Last Published: " + document.lastModified);
              //  --></script></font></td>
  </tr>
  <tr>
  <td colspan="2" align="left" bgcolor="#CFDCED" class="logos"></td>
  </tr>
  </table>
  <!--================= end Footer ==================-->
  </body>
  </html>
  
  
  
  1.1                  cocoon-site/site/2.1/userdocs/flow/sitemap.pdf
  
  	<<Binary file>>
  
  
  1.1                  cocoon-site/site/2.1/userdocs/flow/using.html
  
  Index: using.html
  ===================================================================
  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  <html>
  <head>
  <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  <title>Advanced Control Flow</title>
  <link type="text/css" href="../../skin/page.css" rel="stylesheet">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
  <!--================= start Navigation Path ==================-->
  <table summary="navigation path" width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td nowrap="nowrap" valign="middle" bgcolor="#CFDCED" height="20"><img height="1" width="5" alt="" src="../../skin/images/spacer.gif" class="spacer"><!--===== breadcrumb trail (javascript-generated) ====--><font size="2" face="Arial, Helvetica, Sans-serif"><script src="../../skin/breadcrumbs.js" language="JavaScript" type="text/javascript"></script></font></td>
  </tr>
  <tr>
  <td bgcolor="#4C6C8F" height="2"><img height="2" width="2" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  </table>
  <!--================= end Navigation Path ==================-->
  <!--================= start Banner ==================-->
  <table summary="header with logos" width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <!--================= start Group Logo ==================-->
  <td bgcolor="#294563"><a href=""></a></td>
  <!--================= end Group Logo ==================-->
  <!--================= start Project Logo ==================--><td width="100%" align="center" bgcolor="#294563"><a href="http://cocoon.apache.org/"><img border="0" class="logoImage" alt="Apache Cocoon" src="../../images/project-logo.gif"></a></td>
  <!--================= end Project Logo ==================-->
  <!--================= start Search ==================--><td valign="top" rowspan="2" bgcolor="#294563">
  <form target="_blank" action="http://www.google.com/search" method="get">
  <table summary="search" border="0" cellspacing="0" cellpadding="0" bgcolor="#4C6C8F">
  <tr>
  <td colspan="3"><img height="10" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td><img height="1" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td nowrap="nowrap"><input value="cocoon.apache.org" name="sitesearch" type="hidden"><input size="15" name="q" id="query" type="text"><img height="1" width="5" alt="" src="../../skin/images/spacer.gif" class="spacer"><input name="Search" value="Search" type="submit">
  <br>
  <font face="Arial, Helvetica, Sans-serif" size="2" color="white">
                        the Apache Cocoon site
                        
                        
                      </font></td><td><img height="1" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td><img alt="" border="0" height="10" width="9" src="../../skin/images/search-left.gif"></td><td><img height="1" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td><img alt="" border="0" height="10" width="9" src="../../skin/images/search-right.gif"></td>
  </tr>
  </table>
  </form>
  </td>
  <!--================= start Search ==================--><td bgcolor="#294563"><img height="10" width="10" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td valign="bottom" bgcolor="#294563" colspan="2">
  <!--================= start Tabs ==================-->
  <div class="tab">
  <table summary="tab bar" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td width="6"><img alt="" height="8" width="6" src="../../skin/images/spacer.gif"></td><td valign="bottom">
  <table summary="selected tab" style="height: 1.8em" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td valign="top" width="5" bgcolor="#4C6C8F"><img height="5" width="5" alt="" src="../../skin/images/tabSel-left.gif"></td><td valign="middle" bgcolor="#4C6C8F"><font color="#ffffff" size="2" face="Arial, Helvetica, Sans-serif"><b><a href="../../index.html"><font color="#000000">Home</font></a></b></font></td><td valign="top" width="5" bgcolor="#4C6C8F"><img height="5" width="5" alt="" src="../../skin/images/tabSel-right.gif"></td>
  </tr>
  </table>
  </td>
  </tr>
  </table>
  </div>
  <!--================= end Tabs ==================-->
  </td><td bgcolor="#294563"><img alt="" width="1" height="1" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td bgcolor="#4C6C8F" colspan="4"><img width="1" height="10" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  </table>
  <!--================= end Banner ==================-->
  <!--================= start Menu, NavBar, Content ==================-->
  <table summary="page content" bgcolor="#ffffff" width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td valign="top">
  <table summary="menu" border="0" cellspacing="0" cellpadding="0">
  <tr>
  <!--================= start left top NavBar ==================-->
  <td rowspan="3" valign="top">
  <table summary="blue line" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td bgcolor="#294563"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td bgcolor="#CFDCED"><font color="#4C6C8F" size="4" face="Arial, Helvetica, Sans-serif">&nbsp;</font></td>
  </tr>
  <tr>
  <td bgcolor="#294563"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  </table>
  </td>
  <!--================= end left top NavBar ==================--><td bgcolor="#294563"><img width="1" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td valign="bottom" bgcolor="#4C6C8F"><img width="10" height="10" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td nowrap="nowrap" valign="top" bgcolor="#4C6C8F">
  <!--================= start Menu items ==================-->
  <div class="menu">
  <ul>
  <li>
  <font color="#CFDCED">Navigation</font>
  <ul>
      
  <li>
  <a href="../../index.html">Main</a>
  </li>
      
  <li>
  <a href="../index.html">User Documentation</a>
  </li>
    
  </ul>
  </li>
  <li>
  <font color="#CFDCED">Flowscript</font>
  <ul>
      
  <li>
  <a href="index.html">Introduction</a>
  </li>
      
  <li>
  <a href="continuations.html">Continuations</a>
  </li>
      
  <li>
  <a href="how-does-it-work.html">How does it work?</a>
  </li>
      
  <li>
  <span class="sel"><font color="#ffcc00">Usage</font></span>
  </li>
      
  <li>
  <a href="sitemap.html">Sitemap</a>
  </li>
      
  <li>
  <a href="api.html">JavaScript API</a>
  </li>
      
  <li>
  <a href="views.html">Views</a>
  </li>
      
  <li>
  <a href="jxtemplate.html">JXTemplate</a>
  </li>
      
  <li>
  <a href="jpath.html">JPath</a>
  </li>
      
  <li>
  <a href="velocity.html">Velocity</a>
  </li> 
      
  <li>
  <a href="jxforms.html">JXForms</a>
  </li>
      
  <li>
  <a href="woody.html">Woody</a>
  </li>
    
  </ul>
  </li>
  </ul>
  </div>
  <!--================= end Menu items ==================-->
  </td><td valign="bottom" bgcolor="#4C6C8F"><img width="10" height="10" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td bgcolor="#294563"><img width="1" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td valign="bottom" align="left" colspan="2" rowspan="2" bgcolor="#4C6C8F"><img height="10" width="10" border="0" alt="" src="../../skin/images/menu-left.gif"></td><td bgcolor="#4C6C8F"><img height="10" width="10" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td valign="bottom" align="right" colspan="2" rowspan="2" bgcolor="#4C6C8F"><img height="10" width="10" border="0" alt="" src="../../skin/images/menu-right.gif"></td>
  </tr>
  <tr>
  <td height="1" bgcolor="#294563"><img width="1" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  </table>
  </td><td valign="top" width="100%">
  <table summary="content" width="100%" border="0" cellpadding="0" cellspacing="0">
  <!--================= start middle NavBar ==================-->
  <tr>
  <td colspan="4" bgcolor="#294563"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td align="left" width="10" bgcolor="#CFDCED"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td align="left" width="50%" bgcolor="#CFDCED"><font color="#4C6C8F" size="3" face="Arial, Helvetica, Sans-serif">
                  &nbsp;
                  
                  </font><img width="10" height="8" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td align="right" width="50%" bgcolor="#CFDCED"><font color="#4C6C8F" size="3" face="Arial, Helvetica, Sans-serif">
                  &nbsp;
                  
                  </font><img width="10" height="8" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td width="10" bgcolor="#CFDCED"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td colspan="4" bgcolor="#294563"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <!--================= end middle NavBar ==================-->
  <!--================= start Content==================-->
  <tr>
  <td align="left" width="10"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td align="left" width="100%">
  <div class="content">
  <table class="title" summary="">
  <tr>
  <td valign="middle">
  <h1>Advanced Control Flow</h1>
  </td><script Language="Javascript">
  
  function printit(){  
  if (window.print) {
      window.print() ;  
  } else {
      var WebBrowser = '<OBJECT CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" HEIGHT="0" WIDTH="0" ID="WebBrowser1"></OBJECT>';
  document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
      WebBrowser1.ExecWB(6, 2);//Use a 1 vs. a 2 for a prompting dialog box    WebBrowser1.outerHTML = "";  
  }
  }
  </script><script Language="Javascript">  
  var NS = (navigator.appName == "Netscape");
  var VERSION = parseInt(navigator.appVersion);
  if (VERSION > 3) {
      document.write('<td nowrap="nowrap" width="40" align="center">');     
      document.write('  <a class="dida" href="javascript:printit()">');        
      document.write('    <img alt="Print this Page" src="../../skin/images/printer.gif" class="skin"><br>');   
      document.write('  print</a>');   
      document.write('</td>');           
  }
  </script><td nowrap="nowrap" width="40" align="center"><a class="dida" href="using.pdf"><img alt="PDF" src="../../skin/images/pdfdoc.gif" class="skin"><br>
            PDF</a></td>
  </tr>
  </table>
  <p>
  <font size="-2">by&nbsp;Ovidiu Predescu</font>
  </p>
  <ul class="minitoc">
  <li>
  <a href="#Using+Cocoon%27s+Control+Flow">Using Cocoon's Control Flow</a>
  <ul class="minitoc">
  <li>
  <a href="#Basic+usage">Basic usage</a>
  </li>
  </ul>
  </li>
  </ul>
    
  <a name="N10013"></a><a name="Using+Cocoon%27s+Control+Flow"></a>
  <h3>Using Cocoon's Control Flow</h3>
  <div style="margin-left: 0 ; border: 2px">
  <p>
      The general flow of actions in an application which uses the control flow
      is as described below.
    </p>
  <p>
      The request is received by Cocoon and passed to the sitemap for
      processing. In the sitemap, you can do two things to pass the control to
      the Control Flow layer:</p>
  <ul>
      
  <li>
        You can invoke a JavaScript top-level function to start processing a
        logically grouped sequences of pages. Each time a response page is
        being sent back to the client browser from this function, the
        processing of the JavaScript  code stops at the point the page is
        sent back, and the HTTP request finishes. Through the magic of
        continuations, the execution state is saved in a continuation object.
        Each continuation is given a unique string id, which could be embedded
        in generated page, so that you can restart the saved computation later
        on.
      </li>
      
  <li>
        To invoke a top level JavaScript function in the Control Flow, you use
        the <a href="sitemap.html#callFunction"><span class="codefrag">&lt;map:call&nbsp;function="function-name"/&gt;</span></a>
        construction.
      </li>
      
  <li>
        To restart the computation of a previously stopped function, you use
        the <a href="sitemap.html#callContinuation"><span class="codefrag">&lt;map:call&nbsp;continuation="..."/&gt;</span></a> construction.
        This restarts the computation saved in a continuation object
        identified by the string value of the <span class="codefrag">continuation</span> attribute.
        This value could be extracted in the sitemap from the requested URL,
        from a POST or GET parameter etc. When the computation stored in the
        continuation object is restarted, it appears as if nothing happened,
        all the local and global variables have exactly the same values as
        they had when the computation was stopped.
      </li>
    
  </ul>
  <p>
      Once the JavaScript function in the control layer is restarted, you're
      effectively inside the Control Flow. Here you have access to the request
      parameters, and to the business logic objects. The controller script
      takes the appropriate actions to invoke the business logic, usually
      written in Java, creating objects, setting various values on them etc...
    </p>
  <p>
      When the business logic is invoked, you're inside the Model. The business
      logic takes whatever actions are needed, accessing a database, making a
      SOAP request to a Web service etc. When this logic finishes, the program
      control goes back to the Control Flow.
    </p>
  <p>
      Once here, the Control Flow has to decide which page needs to be sent back
      to the client browser. To do this, the script can invoke one of the
      <a href="api.html#sendPageAndWait"><span class="codefrag">cocoon.sendPageAndWait()</span></a> or <a href="api.html#sendPage"><span class="codefrag">cocoon.sendPage()</span></a> functions.
      These functions take two parameters, the relative URL of the page to be
      sent back to the client, and a context object which can be accessed
      inside this page to extract various values and place them in the
      generated page.
    </p>
  <p>
      The second argument to <span class="codefrag">cocoon.sendPageAndWait()</span> and
      <span class="codefrag">cocoon.sendPage()</span> is a context object, which can be a
      simple dictionary with values that need to be displayed by the View. More
      generally any Java or JavaScript object can be passed here, as long as
      the necessary get methods for the important values are provided.
    </p>
  <p>
      The page specified by the URL is processed by the sitemap, using the
      normal sitemap rules. The simplest case is a <a href="views.html">generator</a> followed by
      an XSLT transformation and a serializer. This page generation is part of
      the View layer. To process a page you can make use of several
      Cocoon <a href="views.html">generators</a> to retrieve values from the context objects passed by the
      Control Flow.
    </p>
  <p>
      Going back to the <span class="codefrag">cocoon.sendPageAndWait()</span> and
      <span class="codefrag">sendPage()</span> functions, there is a big difference
      between them. The first function will send the response back to the
      client browser, and will stop the processing of the JavaScript script by
      saving it into a continuation object. The other function,
      <span class="codefrag">cocoon.sendPage()</span> will send the response, but it will not
      stop the computation. This is useful for example when you need to exit a
      top-level JavaScript function invoked with
      <span class="codefrag">&lt;map:call&nbsp;function="..."/&gt;</span>.
    </p>
  <p>
      The above explains how MVC could be really achieved in Cocoon with the
      control flow layer. Note that there is no direct communication between
      Model and View, everything is directed by the Control Flow by passing to
      View a context object constructed from Model data.
    </p>
  <a name="N10070"></a><a name="Basic+usage"></a>
  <h4>Basic usage</h4>
  <div style="margin-left: 0 ; border: 2px">
  <p>
      As hinted in the previous section, an application using Cocoon's MVC
      approach is composed of three layers:</p>
  <ul>
      
  <li>
        A JavaScript controller which implements the interaction with the
        client
      </li>
      
  <li>
       The business logic model which implements your application
      </li>
      
  <li>
        The <a href="views.html">page templates</a>, which describe the content of the pages, and XSLT
        stylesheets which describe the look of the content.
      </li>
    
  </ul>
  <p>
      In more complex applications, the flow of pages can be thought of smaller
      sequences of pages which are composed together. The natural analogy is to
      describe these sequences in separate JavaScript functions, which can then
      be called either from the sitemap, can call each other freely.
    </p>
  <p>
      An example of such an application is the user login and preferences
      sample 
    </p>
  <p>
      This application is composed of four top-level JavaScript functions:</p>
  <ul>
      
  <li>
  <span class="codefrag">login</span>,</li>
      
  <li>
  <span class="codefrag">registerUser</span>,</li>
      
  <li>
  <span class="codefrag">edit</span> and</li>
      
  <li>
  <span class="codefrag">logout</span>.</li>
    
  </ul>
  <p>
      The entry level point in the application can be any of these functions,
      but in order for a user to use the application, (s)he must login first.
      Once the user logs in, we want to maintain the Java User object which
      represents the user between top-level function invocations.
    </p>
  <p>
      Even if you don't need complex control flow in your application, you may
      still choose to use the MVC pattern described above. You can have top-
      level JavaScript functions which obtain the request parameters, invoke
      the business logic and then call <span class="codefrag">cocoon.sendPage()</span> to
      generate a response page and return from the computation. Since there's
      no continuation object being created by this function, and no global
      scope being saved, there's no memory resource being eaten. The approach
      provides a clean way of separating logic and content, and makes things
      easy to follow, since you have to look at a single script to understand
      what's going on.
    </p>
  </div>
  </div>
    
  </div>
  </td><td width="10"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <!--================= end Content==================-->
  </table>
  </td>
  </tr>
  </table>
  <!--================= end Menu, NavBar, Content ==================-->
  <!--================= start Footer ==================-->
  <table summary="footer" cellspacing="0" cellpadding="0" width="100%" border="0">
  <tr>
  <td colspan="2" height="1" bgcolor="#4C6C8F"><img height="1" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"><a href="../../skin/images/label.gif"></a><a href="../../skin/images/page.gif"></a><a href="../../skin/images/chapter.gif"></a><a href="../../skin/images/chapter_open.gif"></a><a href="../../skin/images/current.gif"></a><a href="../..//favicon.ico"></a></td>
  </tr>
  <tr>
  <td colspan="2" bgcolor="#CFDCED" class="copyright" align="center"><font size="2" face="Arial, Helvetica, Sans-Serif">Copyright &copy;
            1999-2003&nbsp;The Apache Software Foundation. All rights reserved.<script type="text/javascript" language="JavaScript"><!--
                document.write(" - "+"Last Published: " + document.lastModified);
              //  --></script></font></td>
  </tr>
  <tr>
  <td colspan="2" align="left" bgcolor="#CFDCED" class="logos"></td>
  </tr>
  </table>
  <!--================= end Footer ==================-->
  </body>
  </html>
  
  
  
  1.1                  cocoon-site/site/2.1/userdocs/flow/using.pdf
  
  	<<Binary file>>
  
  
  1.1                  cocoon-site/site/2.1/userdocs/flow/velocity.html
  
  Index: velocity.html
  ===================================================================
  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  <html>
  <head>
  <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  <title>Advanced Control Flow</title>
  <link type="text/css" href="../../skin/page.css" rel="stylesheet">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
  <!--================= start Navigation Path ==================-->
  <table summary="navigation path" width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td nowrap="nowrap" valign="middle" bgcolor="#CFDCED" height="20"><img height="1" width="5" alt="" src="../../skin/images/spacer.gif" class="spacer"><!--===== breadcrumb trail (javascript-generated) ====--><font size="2" face="Arial, Helvetica, Sans-serif"><script src="../../skin/breadcrumbs.js" language="JavaScript" type="text/javascript"></script></font></td>
  </tr>
  <tr>
  <td bgcolor="#4C6C8F" height="2"><img height="2" width="2" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  </table>
  <!--================= end Navigation Path ==================-->
  <!--================= start Banner ==================-->
  <table summary="header with logos" width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <!--================= start Group Logo ==================-->
  <td bgcolor="#294563"><a href=""></a></td>
  <!--================= end Group Logo ==================-->
  <!--================= start Project Logo ==================--><td width="100%" align="center" bgcolor="#294563"><a href="http://cocoon.apache.org/"><img border="0" class="logoImage" alt="Apache Cocoon" src="../../images/project-logo.gif"></a></td>
  <!--================= end Project Logo ==================-->
  <!--================= start Search ==================--><td valign="top" rowspan="2" bgcolor="#294563">
  <form target="_blank" action="http://www.google.com/search" method="get">
  <table summary="search" border="0" cellspacing="0" cellpadding="0" bgcolor="#4C6C8F">
  <tr>
  <td colspan="3"><img height="10" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td><img height="1" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td nowrap="nowrap"><input value="cocoon.apache.org" name="sitesearch" type="hidden"><input size="15" name="q" id="query" type="text"><img height="1" width="5" alt="" src="../../skin/images/spacer.gif" class="spacer"><input name="Search" value="Search" type="submit">
  <br>
  <font face="Arial, Helvetica, Sans-serif" size="2" color="white">
                        the Apache Cocoon site
                        
                        
                      </font></td><td><img height="1" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td><img alt="" border="0" height="10" width="9" src="../../skin/images/search-left.gif"></td><td><img height="1" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td><img alt="" border="0" height="10" width="9" src="../../skin/images/search-right.gif"></td>
  </tr>
  </table>
  </form>
  </td>
  <!--================= start Search ==================--><td bgcolor="#294563"><img height="10" width="10" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td valign="bottom" bgcolor="#294563" colspan="2">
  <!--================= start Tabs ==================-->
  <div class="tab">
  <table summary="tab bar" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td width="6"><img alt="" height="8" width="6" src="../../skin/images/spacer.gif"></td><td valign="bottom">
  <table summary="selected tab" style="height: 1.8em" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td valign="top" width="5" bgcolor="#4C6C8F"><img height="5" width="5" alt="" src="../../skin/images/tabSel-left.gif"></td><td valign="middle" bgcolor="#4C6C8F"><font color="#ffffff" size="2" face="Arial, Helvetica, Sans-serif"><b><a href="../../index.html"><font color="#000000">Home</font></a></b></font></td><td valign="top" width="5" bgcolor="#4C6C8F"><img height="5" width="5" alt="" src="../../skin/images/tabSel-right.gif"></td>
  </tr>
  </table>
  </td>
  </tr>
  </table>
  </div>
  <!--================= end Tabs ==================-->
  </td><td bgcolor="#294563"><img alt="" width="1" height="1" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td bgcolor="#4C6C8F" colspan="4"><img width="1" height="10" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  </table>
  <!--================= end Banner ==================-->
  <!--================= start Menu, NavBar, Content ==================-->
  <table summary="page content" bgcolor="#ffffff" width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td valign="top">
  <table summary="menu" border="0" cellspacing="0" cellpadding="0">
  <tr>
  <!--================= start left top NavBar ==================-->
  <td rowspan="3" valign="top">
  <table summary="blue line" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td bgcolor="#294563"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td bgcolor="#CFDCED"><font color="#4C6C8F" size="4" face="Arial, Helvetica, Sans-serif">&nbsp;</font></td>
  </tr>
  <tr>
  <td bgcolor="#294563"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  </table>
  </td>
  <!--================= end left top NavBar ==================--><td bgcolor="#294563"><img width="1" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td valign="bottom" bgcolor="#4C6C8F"><img width="10" height="10" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td nowrap="nowrap" valign="top" bgcolor="#4C6C8F">
  <!--================= start Menu items ==================-->
  <div class="menu">
  <ul>
  <li>
  <font color="#CFDCED">Navigation</font>
  <ul>
      
  <li>
  <a href="../../index.html">Main</a>
  </li>
      
  <li>
  <a href="../index.html">User Documentation</a>
  </li>
    
  </ul>
  </li>
  <li>
  <font color="#CFDCED">Flowscript</font>
  <ul>
      
  <li>
  <a href="index.html">Introduction</a>
  </li>
      
  <li>
  <a href="continuations.html">Continuations</a>
  </li>
      
  <li>
  <a href="how-does-it-work.html">How does it work?</a>
  </li>
      
  <li>
  <a href="using.html">Usage</a>
  </li>
      
  <li>
  <a href="sitemap.html">Sitemap</a>
  </li>
      
  <li>
  <a href="api.html">JavaScript API</a>
  </li>
      
  <li>
  <a href="views.html">Views</a>
  </li>
      
  <li>
  <a href="jxtemplate.html">JXTemplate</a>
  </li>
      
  <li>
  <a href="jpath.html">JPath</a>
  </li>
      
  <li>
  <span class="sel"><font color="#ffcc00">Velocity</font></span>
  </li> 
      
  <li>
  <a href="jxforms.html">JXForms</a>
  </li>
      
  <li>
  <a href="woody.html">Woody</a>
  </li>
    
  </ul>
  </li>
  </ul>
  </div>
  <!--================= end Menu items ==================-->
  </td><td valign="bottom" bgcolor="#4C6C8F"><img width="10" height="10" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td bgcolor="#294563"><img width="1" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td valign="bottom" align="left" colspan="2" rowspan="2" bgcolor="#4C6C8F"><img height="10" width="10" border="0" alt="" src="../../skin/images/menu-left.gif"></td><td bgcolor="#4C6C8F"><img height="10" width="10" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td valign="bottom" align="right" colspan="2" rowspan="2" bgcolor="#4C6C8F"><img height="10" width="10" border="0" alt="" src="../../skin/images/menu-right.gif"></td>
  </tr>
  <tr>
  <td height="1" bgcolor="#294563"><img width="1" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  </table>
  </td><td valign="top" width="100%">
  <table summary="content" width="100%" border="0" cellpadding="0" cellspacing="0">
  <!--================= start middle NavBar ==================-->
  <tr>
  <td colspan="4" bgcolor="#294563"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td align="left" width="10" bgcolor="#CFDCED"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td align="left" width="50%" bgcolor="#CFDCED"><font color="#4C6C8F" size="3" face="Arial, Helvetica, Sans-serif">
                  &nbsp;
                  
                  </font><img width="10" height="8" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td align="right" width="50%" bgcolor="#CFDCED"><font color="#4C6C8F" size="3" face="Arial, Helvetica, Sans-serif">
                  &nbsp;
                  
                  </font><img width="10" height="8" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td width="10" bgcolor="#CFDCED"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td colspan="4" bgcolor="#294563"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <!--================= end middle NavBar ==================-->
  <!--================= start Content==================-->
  <tr>
  <td align="left" width="10"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td align="left" width="100%">
  <div class="content">
  <table class="title" summary="">
  <tr>
  <td valign="middle">
  <h1>Advanced Control Flow</h1>
  </td><script Language="Javascript">
  
  function printit(){  
  if (window.print) {
      window.print() ;  
  } else {
      var WebBrowser = '<OBJECT CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" HEIGHT="0" WIDTH="0" ID="WebBrowser1"></OBJECT>';
  document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
      WebBrowser1.ExecWB(6, 2);//Use a 1 vs. a 2 for a prompting dialog box    WebBrowser1.outerHTML = "";  
  }
  }
  </script><script Language="Javascript">  
  var NS = (navigator.appName == "Netscape");
  var VERSION = parseInt(navigator.appVersion);
  if (VERSION > 3) {
      document.write('<td nowrap="nowrap" width="40" align="center">');     
      document.write('  <a class="dida" href="javascript:printit()">');        
      document.write('    <img alt="Print this Page" src="../../skin/images/printer.gif" class="skin"><br>');   
      document.write('  print</a>');   
      document.write('</td>');           
  }
  </script><td nowrap="nowrap" width="40" align="center"><a class="dida" href="velocity.pdf"><img alt="PDF" src="../../skin/images/pdfdoc.gif" class="skin"><br>
            PDF</a></td>
  </tr>
  </table>
  <p>
  <font size="-2">by&nbsp;Christopher Oliver,&nbsp;Ovidiu Predescu</font>
  </p>
  <ul class="minitoc">
  <li>
  <a href="#Velocity+Generator">Velocity Generator</a>
  </li>
  </ul>
    
  <a name="N10017"></a><a name="Velocity+Generator"></a>
  <h3>Velocity Generator</h3>
  <div style="margin-left: 0 ; border: 2px">
  <p>If called from a Flowscript, the Cocoon
      <a href="http://jakarta.apache.org/velocity">Velocity</a>
      <a href="../generators/velocity-generator.html">Generator</a>
      provides access to the immediate properties of the context object passed to
      <a href="api.html#sendPage"><span class="codefrag">sendPage</span></a> and
      <a href="api.html#sendPageAndWait"><span class="codefrag">sendPageAndWait</span></a>. In addition,
      the current <a href="api.html#WebContinuation"><span class="codefrag">WebContinuation</span></a>
      is also available as a variable named <span class="codefrag">$continuation</span>. You would typically access
      its <span class="codefrag">id</span>:</p>
  <pre class="code">
    &lt;form action="$continuation.id"&gt;
     </pre>
  <p>You can also reach previous continuations by using the <span class="codefrag">getParent()</span> function:</p>
  <pre class="code">
    &lt;form action="$continuation.getParent().id" &gt;
     </pre>
  <p>In addition the following implicit objects are always available in the Velocity context:</p>
  <dl>
      
  <dt>
  <a href="../../apidocs/java/org/apache/cocoon/environment/Request.html">Request</a> <span class="codefrag">$request</span> 
  </dt>
      
  <dd>The current Cocoon request</dd>
      
  <dt>
  <a href="../../apidocs/java/org/apache/cocoon/environment/Response.html">Response</a> <span class="codefrag">$response</span> 
  </dt>
      
  <dd>The Cocoon response associated with the current request</dd>
      
  <dt>
  <a href="../../apidocs/java/org/apache/cocoon/environment/Session.html">Session</a> <span class="codefrag">$session</span> 
  </dt>
      
  <dd>The Cocoon session associated with the current request</dd>
      
  <dt>
  <a href="../../apidocs/java/org/apache/cocoon/environment/Context.html">Context</a> <span class="codefrag">$context</span> 
  </dt>
      
  <dd>The Cocoon context associated with the current request</dd>
      
  <dt>
  <span class="codefrag">org.apache.avalon.framework.parameters.Parameters</span> <span class="codefrag">$parameters</span> 
  </dt>
      
  <dd>Any parameters passed to the generator in the pipeline</dd>
     
  </dl>
  <p>
     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:</p>
  <pre class="code">
      sendPage("myTemplate.vm", {colors: ["red", "blue", "yellow"]});
     </pre>
  <p>
      You could do this in <span class="codefrag">myTemplate.vm</span>:</p>
  <pre class="code">
      &lt;select name="colors"&gt;
      #foreach ($color in $colors) 
        &lt;option value="$color"&gt;$color&lt;/option&gt;
      #end
      &lt;/select&gt;
      </pre>
  </div>
   
  </div>
  </td><td width="10"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <!--================= end Content==================-->
  </table>
  </td>
  </tr>
  </table>
  <!--================= end Menu, NavBar, Content ==================-->
  <!--================= start Footer ==================-->
  <table summary="footer" cellspacing="0" cellpadding="0" width="100%" border="0">
  <tr>
  <td colspan="2" height="1" bgcolor="#4C6C8F"><img height="1" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"><a href="../../skin/images/label.gif"></a><a href="../../skin/images/page.gif"></a><a href="../../skin/images/chapter.gif"></a><a href="../../skin/images/chapter_open.gif"></a><a href="../../skin/images/current.gif"></a><a href="../..//favicon.ico"></a></td>
  </tr>
  <tr>
  <td colspan="2" bgcolor="#CFDCED" class="copyright" align="center"><font size="2" face="Arial, Helvetica, Sans-Serif">Copyright &copy;
            1999-2003&nbsp;The Apache Software Foundation. All rights reserved.<script type="text/javascript" language="JavaScript"><!--
                document.write(" - "+"Last Published: " + document.lastModified);
              //  --></script></font></td>
  </tr>
  <tr>
  <td colspan="2" align="left" bgcolor="#CFDCED" class="logos"></td>
  </tr>
  </table>
  <!--================= end Footer ==================-->
  </body>
  </html>
  
  
  
  1.1                  cocoon-site/site/2.1/userdocs/flow/velocity.pdf
  
  	<<Binary file>>
  
  
  1.1                  cocoon-site/site/2.1/userdocs/flow/views.html
  
  Index: views.html
  ===================================================================
  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  <html>
  <head>
  <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  <title>Advanced Control Flow</title>
  <link type="text/css" href="../../skin/page.css" rel="stylesheet">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
  <!--================= start Navigation Path ==================-->
  <table summary="navigation path" width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td nowrap="nowrap" valign="middle" bgcolor="#CFDCED" height="20"><img height="1" width="5" alt="" src="../../skin/images/spacer.gif" class="spacer"><!--===== breadcrumb trail (javascript-generated) ====--><font size="2" face="Arial, Helvetica, Sans-serif"><script src="../../skin/breadcrumbs.js" language="JavaScript" type="text/javascript"></script></font></td>
  </tr>
  <tr>
  <td bgcolor="#4C6C8F" height="2"><img height="2" width="2" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  </table>
  <!--================= end Navigation Path ==================-->
  <!--================= start Banner ==================-->
  <table summary="header with logos" width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <!--================= start Group Logo ==================-->
  <td bgcolor="#294563"><a href=""></a></td>
  <!--================= end Group Logo ==================-->
  <!--================= start Project Logo ==================--><td width="100%" align="center" bgcolor="#294563"><a href="http://cocoon.apache.org/"><img border="0" class="logoImage" alt="Apache Cocoon" src="../../images/project-logo.gif"></a></td>
  <!--================= end Project Logo ==================-->
  <!--================= start Search ==================--><td valign="top" rowspan="2" bgcolor="#294563">
  <form target="_blank" action="http://www.google.com/search" method="get">
  <table summary="search" border="0" cellspacing="0" cellpadding="0" bgcolor="#4C6C8F">
  <tr>
  <td colspan="3"><img height="10" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td><img height="1" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td nowrap="nowrap"><input value="cocoon.apache.org" name="sitesearch" type="hidden"><input size="15" name="q" id="query" type="text"><img height="1" width="5" alt="" src="../../skin/images/spacer.gif" class="spacer"><input name="Search" value="Search" type="submit">
  <br>
  <font face="Arial, Helvetica, Sans-serif" size="2" color="white">
                        the Apache Cocoon site
                        
                        
                      </font></td><td><img height="1" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td><img alt="" border="0" height="10" width="9" src="../../skin/images/search-left.gif"></td><td><img height="1" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td><img alt="" border="0" height="10" width="9" src="../../skin/images/search-right.gif"></td>
  </tr>
  </table>
  </form>
  </td>
  <!--================= start Search ==================--><td bgcolor="#294563"><img height="10" width="10" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td valign="bottom" bgcolor="#294563" colspan="2">
  <!--================= start Tabs ==================-->
  <div class="tab">
  <table summary="tab bar" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td width="6"><img alt="" height="8" width="6" src="../../skin/images/spacer.gif"></td><td valign="bottom">
  <table summary="selected tab" style="height: 1.8em" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td valign="top" width="5" bgcolor="#4C6C8F"><img height="5" width="5" alt="" src="../../skin/images/tabSel-left.gif"></td><td valign="middle" bgcolor="#4C6C8F"><font color="#ffffff" size="2" face="Arial, Helvetica, Sans-serif"><b><a href="../../index.html"><font color="#000000">Home</font></a></b></font></td><td valign="top" width="5" bgcolor="#4C6C8F"><img height="5" width="5" alt="" src="../../skin/images/tabSel-right.gif"></td>
  </tr>
  </table>
  </td>
  </tr>
  </table>
  </div>
  <!--================= end Tabs ==================-->
  </td><td bgcolor="#294563"><img alt="" width="1" height="1" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td bgcolor="#4C6C8F" colspan="4"><img width="1" height="10" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  </table>
  <!--================= end Banner ==================-->
  <!--================= start Menu, NavBar, Content ==================-->
  <table summary="page content" bgcolor="#ffffff" width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td valign="top">
  <table summary="menu" border="0" cellspacing="0" cellpadding="0">
  <tr>
  <!--================= start left top NavBar ==================-->
  <td rowspan="3" valign="top">
  <table summary="blue line" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td bgcolor="#294563"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td bgcolor="#CFDCED"><font color="#4C6C8F" size="4" face="Arial, Helvetica, Sans-serif">&nbsp;</font></td>
  </tr>
  <tr>
  <td bgcolor="#294563"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  </table>
  </td>
  <!--================= end left top NavBar ==================--><td bgcolor="#294563"><img width="1" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td valign="bottom" bgcolor="#4C6C8F"><img width="10" height="10" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td nowrap="nowrap" valign="top" bgcolor="#4C6C8F">
  <!--================= start Menu items ==================-->
  <div class="menu">
  <ul>
  <li>
  <font color="#CFDCED">Navigation</font>
  <ul>
      
  <li>
  <a href="../../index.html">Main</a>
  </li>
      
  <li>
  <a href="../index.html">User Documentation</a>
  </li>
    
  </ul>
  </li>
  <li>
  <font color="#CFDCED">Flowscript</font>
  <ul>
      
  <li>
  <a href="index.html">Introduction</a>
  </li>
      
  <li>
  <a href="continuations.html">Continuations</a>
  </li>
      
  <li>
  <a href="how-does-it-work.html">How does it work?</a>
  </li>
      
  <li>
  <a href="using.html">Usage</a>
  </li>
      
  <li>
  <a href="sitemap.html">Sitemap</a>
  </li>
      
  <li>
  <a href="api.html">JavaScript API</a>
  </li>
      
  <li>
  <span class="sel"><font color="#ffcc00">Views</font></span>
  </li>
      
  <li>
  <a href="jxtemplate.html">JXTemplate</a>
  </li>
      
  <li>
  <a href="jpath.html">JPath</a>
  </li>
      
  <li>
  <a href="velocity.html">Velocity</a>
  </li> 
      
  <li>
  <a href="jxforms.html">JXForms</a>
  </li>
      
  <li>
  <a href="woody.html">Woody</a>
  </li>
    
  </ul>
  </li>
  </ul>
  </div>
  <!--================= end Menu items ==================-->
  </td><td valign="bottom" bgcolor="#4C6C8F"><img width="10" height="10" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td bgcolor="#294563"><img width="1" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td valign="bottom" align="left" colspan="2" rowspan="2" bgcolor="#4C6C8F"><img height="10" width="10" border="0" alt="" src="../../skin/images/menu-left.gif"></td><td bgcolor="#4C6C8F"><img height="10" width="10" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td valign="bottom" align="right" colspan="2" rowspan="2" bgcolor="#4C6C8F"><img height="10" width="10" border="0" alt="" src="../../skin/images/menu-right.gif"></td>
  </tr>
  <tr>
  <td height="1" bgcolor="#294563"><img width="1" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  </table>
  </td><td valign="top" width="100%">
  <table summary="content" width="100%" border="0" cellpadding="0" cellspacing="0">
  <!--================= start middle NavBar ==================-->
  <tr>
  <td colspan="4" bgcolor="#294563"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td align="left" width="10" bgcolor="#CFDCED"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td align="left" width="50%" bgcolor="#CFDCED"><font color="#4C6C8F" size="3" face="Arial, Helvetica, Sans-serif">
                  &nbsp;
                  
                  </font><img width="10" height="8" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td align="right" width="50%" bgcolor="#CFDCED"><font color="#4C6C8F" size="3" face="Arial, Helvetica, Sans-serif">
                  &nbsp;
                  
                  </font><img width="10" height="8" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td width="10" bgcolor="#CFDCED"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td colspan="4" bgcolor="#294563"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <!--================= end middle NavBar ==================-->
  <!--================= start Content==================-->
  <tr>
  <td align="left" width="10"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td align="left" width="100%">
  <div class="content">
  <table class="title" summary="">
  <tr>
  <td valign="middle">
  <h1>Advanced Control Flow</h1>
  </td><script Language="Javascript">
  
  function printit(){  
  if (window.print) {
      window.print() ;  
  } else {
      var WebBrowser = '<OBJECT CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" HEIGHT="0" WIDTH="0" ID="WebBrowser1"></OBJECT>';
  document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
      WebBrowser1.ExecWB(6, 2);//Use a 1 vs. a 2 for a prompting dialog box    WebBrowser1.outerHTML = "";  
  }
  }
  </script><script Language="Javascript">  
  var NS = (navigator.appName == "Netscape");
  var VERSION = parseInt(navigator.appVersion);
  if (VERSION > 3) {
      document.write('<td nowrap="nowrap" width="40" align="center">');     
      document.write('  <a class="dida" href="javascript:printit()">');        
      document.write('    <img alt="Print this Page" src="../../skin/images/printer.gif" class="skin"><br>');   
      document.write('  print</a>');   
      document.write('</td>');           
  }
  </script><td nowrap="nowrap" width="40" align="center"><a class="dida" href="views.pdf"><img alt="PDF" src="../../skin/images/pdfdoc.gif" class="skin"><br>
            PDF</a></td>
  </tr>
  </table>
  <p>
  <font size="-2">by&nbsp;Ovidiu Predescu,&nbsp;Christopher Oliver</font>
  </p>
  <ul class="minitoc">
  <li>
  <a href="#Flowscript-aware+Generators+and+Form+Frameworks">Flowscript-aware Generators and Form Frameworks</a>
  </li>
  </ul>
    
  <a name="N10017"></a><a name="Flowscript-aware+Generators+and+Form+Frameworks"></a>
  <h3>Flowscript-aware Generators and Form Frameworks</h3>
  <div style="margin-left: 0 ; border: 2px">
  <p>The second argument to <a href="api.html#sendPage"><span class="codefrag">cocoon.sendPage()</span></a> and
      <a href="api.html#sendPageAndWait"><span class="codefrag">cocoon.sendPageAndWait()</span></a> is a context object,
      which can be a simple dictionary with values that need to be displayed by the page. More
      generally any Java or JavaScript object can be passed here, as long as the necessary <em>get</em>
      methods for the important values are provided.</p>
  <p>The page specified by the URL is processed by the sitemap, using the normal sitemap rules.</p>
  <p>Several Cocoon generators are provided that allow you to access the context object and inject
      its values into a pipeline. Currently, these are the
      <a href="jxtemplate.html">JXTemplate Generator</a>,
      <a href="jpath.html">JPath XSP Logic Sheet</a> and
      <a href="velocity.html">Velocity Generator</a>.
     </p>
  <p>
       In addition, Cocoon provides several higher-level frameworks to create single and multi-page forms that can be used with your Flowscripts. Currently, these are <a href="jxforms.html">JXForms</a> and <a href="woody.html">Woody</a>.
     </p>
  </div>
   
  </div>
  </td><td width="10"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <!--================= end Content==================-->
  </table>
  </td>
  </tr>
  </table>
  <!--================= end Menu, NavBar, Content ==================-->
  <!--================= start Footer ==================-->
  <table summary="footer" cellspacing="0" cellpadding="0" width="100%" border="0">
  <tr>
  <td colspan="2" height="1" bgcolor="#4C6C8F"><img height="1" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"><a href="../../skin/images/label.gif"></a><a href="../../skin/images/page.gif"></a><a href="../../skin/images/chapter.gif"></a><a href="../../skin/images/chapter_open.gif"></a><a href="../../skin/images/current.gif"></a><a href="../..//favicon.ico"></a></td>
  </tr>
  <tr>
  <td colspan="2" bgcolor="#CFDCED" class="copyright" align="center"><font size="2" face="Arial, Helvetica, Sans-Serif">Copyright &copy;
            1999-2003&nbsp;The Apache Software Foundation. All rights reserved.<script type="text/javascript" language="JavaScript"><!--
                document.write(" - "+"Last Published: " + document.lastModified);
              //  --></script></font></td>
  </tr>
  <tr>
  <td colspan="2" align="left" bgcolor="#CFDCED" class="logos"></td>
  </tr>
  </table>
  <!--================= end Footer ==================-->
  </body>
  </html>
  
  
  
  1.1                  cocoon-site/site/2.1/userdocs/flow/views.pdf
  
  	<<Binary file>>
  
  
  1.1                  cocoon-site/site/2.1/userdocs/flow/woody.html
  
  Index: woody.html
  ===================================================================
  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  <html>
  <head>
  <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  <title>Advanced Control Flow</title>
  <link type="text/css" href="../../skin/page.css" rel="stylesheet">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
  <!--================= start Navigation Path ==================-->
  <table summary="navigation path" width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td nowrap="nowrap" valign="middle" bgcolor="#CFDCED" height="20"><img height="1" width="5" alt="" src="../../skin/images/spacer.gif" class="spacer"><!--===== breadcrumb trail (javascript-generated) ====--><font size="2" face="Arial, Helvetica, Sans-serif"><script src="../../skin/breadcrumbs.js" language="JavaScript" type="text/javascript"></script></font></td>
  </tr>
  <tr>
  <td bgcolor="#4C6C8F" height="2"><img height="2" width="2" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  </table>
  <!--================= end Navigation Path ==================-->
  <!--================= start Banner ==================-->
  <table summary="header with logos" width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <!--================= start Group Logo ==================-->
  <td bgcolor="#294563"><a href=""></a></td>
  <!--================= end Group Logo ==================-->
  <!--================= start Project Logo ==================--><td width="100%" align="center" bgcolor="#294563"><a href="http://cocoon.apache.org/"><img border="0" class="logoImage" alt="Apache Cocoon" src="../../images/project-logo.gif"></a></td>
  <!--================= end Project Logo ==================-->
  <!--================= start Search ==================--><td valign="top" rowspan="2" bgcolor="#294563">
  <form target="_blank" action="http://www.google.com/search" method="get">
  <table summary="search" border="0" cellspacing="0" cellpadding="0" bgcolor="#4C6C8F">
  <tr>
  <td colspan="3"><img height="10" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td><img height="1" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td nowrap="nowrap"><input value="cocoon.apache.org" name="sitesearch" type="hidden"><input size="15" name="q" id="query" type="text"><img height="1" width="5" alt="" src="../../skin/images/spacer.gif" class="spacer"><input name="Search" value="Search" type="submit">
  <br>
  <font face="Arial, Helvetica, Sans-serif" size="2" color="white">
                        the Apache Cocoon site
                        
                        
                      </font></td><td><img height="1" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td><img alt="" border="0" height="10" width="9" src="../../skin/images/search-left.gif"></td><td><img height="1" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td><img alt="" border="0" height="10" width="9" src="../../skin/images/search-right.gif"></td>
  </tr>
  </table>
  </form>
  </td>
  <!--================= start Search ==================--><td bgcolor="#294563"><img height="10" width="10" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td valign="bottom" bgcolor="#294563" colspan="2">
  <!--================= start Tabs ==================-->
  <div class="tab">
  <table summary="tab bar" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td width="6"><img alt="" height="8" width="6" src="../../skin/images/spacer.gif"></td><td valign="bottom">
  <table summary="selected tab" style="height: 1.8em" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td valign="top" width="5" bgcolor="#4C6C8F"><img height="5" width="5" alt="" src="../../skin/images/tabSel-left.gif"></td><td valign="middle" bgcolor="#4C6C8F"><font color="#ffffff" size="2" face="Arial, Helvetica, Sans-serif"><b><a href="../../index.html"><font color="#000000">Home</font></a></b></font></td><td valign="top" width="5" bgcolor="#4C6C8F"><img height="5" width="5" alt="" src="../../skin/images/tabSel-right.gif"></td>
  </tr>
  </table>
  </td>
  </tr>
  </table>
  </div>
  <!--================= end Tabs ==================-->
  </td><td bgcolor="#294563"><img alt="" width="1" height="1" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td bgcolor="#4C6C8F" colspan="4"><img width="1" height="10" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  </table>
  <!--================= end Banner ==================-->
  <!--================= start Menu, NavBar, Content ==================-->
  <table summary="page content" bgcolor="#ffffff" width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td valign="top">
  <table summary="menu" border="0" cellspacing="0" cellpadding="0">
  <tr>
  <!--================= start left top NavBar ==================-->
  <td rowspan="3" valign="top">
  <table summary="blue line" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td bgcolor="#294563"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td bgcolor="#CFDCED"><font color="#4C6C8F" size="4" face="Arial, Helvetica, Sans-serif">&nbsp;</font></td>
  </tr>
  <tr>
  <td bgcolor="#294563"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  </table>
  </td>
  <!--================= end left top NavBar ==================--><td bgcolor="#294563"><img width="1" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td valign="bottom" bgcolor="#4C6C8F"><img width="10" height="10" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td nowrap="nowrap" valign="top" bgcolor="#4C6C8F">
  <!--================= start Menu items ==================-->
  <div class="menu">
  <ul>
  <li>
  <font color="#CFDCED">Navigation</font>
  <ul>
      
  <li>
  <a href="../../index.html">Main</a>
  </li>
      
  <li>
  <a href="../index.html">User Documentation</a>
  </li>
    
  </ul>
  </li>
  <li>
  <font color="#CFDCED">Flowscript</font>
  <ul>
      
  <li>
  <a href="index.html">Introduction</a>
  </li>
      
  <li>
  <a href="continuations.html">Continuations</a>
  </li>
      
  <li>
  <a href="how-does-it-work.html">How does it work?</a>
  </li>
      
  <li>
  <a href="using.html">Usage</a>
  </li>
      
  <li>
  <a href="sitemap.html">Sitemap</a>
  </li>
      
  <li>
  <a href="api.html">JavaScript API</a>
  </li>
      
  <li>
  <a href="views.html">Views</a>
  </li>
      
  <li>
  <a href="jxtemplate.html">JXTemplate</a>
  </li>
      
  <li>
  <a href="jpath.html">JPath</a>
  </li>
      
  <li>
  <a href="velocity.html">Velocity</a>
  </li> 
      
  <li>
  <a href="jxforms.html">JXForms</a>
  </li>
      
  <li>
  <span class="sel"><font color="#ffcc00">Woody</font></span>
  </li>
    
  </ul>
  </li>
  </ul>
  </div>
  <!--================= end Menu items ==================-->
  </td><td valign="bottom" bgcolor="#4C6C8F"><img width="10" height="10" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td bgcolor="#294563"><img width="1" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td valign="bottom" align="left" colspan="2" rowspan="2" bgcolor="#4C6C8F"><img height="10" width="10" border="0" alt="" src="../../skin/images/menu-left.gif"></td><td bgcolor="#4C6C8F"><img height="10" width="10" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td valign="bottom" align="right" colspan="2" rowspan="2" bgcolor="#4C6C8F"><img height="10" width="10" border="0" alt="" src="../../skin/images/menu-right.gif"></td>
  </tr>
  <tr>
  <td height="1" bgcolor="#294563"><img width="1" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  </table>
  </td><td valign="top" width="100%">
  <table summary="content" width="100%" border="0" cellpadding="0" cellspacing="0">
  <!--================= start middle NavBar ==================-->
  <tr>
  <td colspan="4" bgcolor="#294563"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td align="left" width="10" bgcolor="#CFDCED"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td align="left" width="50%" bgcolor="#CFDCED"><font color="#4C6C8F" size="3" face="Arial, Helvetica, Sans-serif">
                  &nbsp;
                  
                  </font><img width="10" height="8" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td align="right" width="50%" bgcolor="#CFDCED"><font color="#4C6C8F" size="3" face="Arial, Helvetica, Sans-serif">
                  &nbsp;
                  
                  </font><img width="10" height="8" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td width="10" bgcolor="#CFDCED"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td colspan="4" bgcolor="#294563"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <!--================= end middle NavBar ==================-->
  <!--================= start Content==================-->
  <tr>
  <td align="left" width="10"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td align="left" width="100%">
  <div class="content">
  <table class="title" summary="">
  <tr>
  <td valign="middle">
  <h1>Advanced Control Flow</h1>
  </td><script Language="Javascript">
  
  function printit(){  
  if (window.print) {
      window.print() ;  
  } else {
      var WebBrowser = '<OBJECT CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" HEIGHT="0" WIDTH="0" ID="WebBrowser1"></OBJECT>';
  document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
      WebBrowser1.ExecWB(6, 2);//Use a 1 vs. a 2 for a prompting dialog box    WebBrowser1.outerHTML = "";  
  }
  }
  </script><script Language="Javascript">  
  var NS = (navigator.appName == "Netscape");
  var VERSION = parseInt(navigator.appVersion);
  if (VERSION > 3) {
      document.write('<td nowrap="nowrap" width="40" align="center">');     
      document.write('  <a class="dida" href="javascript:printit()">');        
      document.write('    <img alt="Print this Page" src="../../skin/images/printer.gif" class="skin"><br>');   
      document.write('  print</a>');   
      document.write('</td>');           
  }
  </script><td nowrap="nowrap" width="40" align="center"><a class="dida" href="woody.pdf"><img alt="PDF" src="../../skin/images/pdfdoc.gif" class="skin"><br>
            PDF</a></td>
  </tr>
  </table>
  <p>
  <font size="-2">by&nbsp;Christopher Oliver,&nbsp;Ovidiu Predescu</font>
  </p>
  <ul class="minitoc">
  <li>
  <a href="#Woody">Woody</a>
  <ul class="minitoc">
  <li>
  <a href="#The+woody+function">The woody function</a>
  </li>
  <li>
  <a href="#Form+Object">Form Object</a>
  </li>
  </ul>
  </li>
  </ul>
    
  <a name="N10017"></a><a name="Woody"></a>
  <h3>Woody</h3>
  <div style="margin-left: 0 ; border: 2px">
  <p>
  <a href="http://wiki.cocoondev.org/Wiki.jsp?page=Woody">Woody</a> is another form framework 
       that can be used in your Flowscripts.</p>
  <div class="frame note">
  <div class="label">Note</div>
  <div class="content">
       Woody is marked as "unstable" block because it is under development!
     </div>
  </div>
  <p>Here is an example:</p>
  <pre class="code">
  
  cocoon.load("resource://org/apache/cocoon/woody/flow/javascript/woody.js");
  
  function form1(form) {
      var model = form.getModel();
      model.email = "bar@www.foo.com";
      model.somebool = true;
      model.account = 2;
      model.cowheight = 4;
      model.number1 = 1;
      model.number2 = 3;
     
      model.contacts[0].firstname = "Jules";
      model.contacts[1].firstname =  "Lucien";
      model.contacts[2].firstname = "Chris";
      model.drinks = ["Jupiler", "Coca Cola"];
     
      form.show("form1-display-pipeline", function(form) {
          switch(form.getSubmitId()) {
          case "remove-selected-contacts":
              {
                  for (var i = model.contacts.length-1; i &gt;= 0; i--) {
                      if (model.contacts[i].select) {
                          model.contacts.remove(i);
                      }
                  }
              }
              break;
          case "add-contact":
              {
                  model.contacts.length++;
              }
              break;
          default:
              return true;
          }
          return false;
      });
      sendPage("form1-success-pipeline");
      form.finish();
  
  }
  </pre>
  <p>
      
  </p>
  <a name="N10030"></a><a name="The+woody+function"></a>
  <h4>The woody function</h4>
  <div style="margin-left: 0 ; border: 2px">
  <a name="woody"></a>
  <p>The entry point to a Woody form is the <span class="codefrag">woody()</span> function:</p>
  <p>
        
  <em>Function</em> <span class="codefrag">woody(form_function, form_definition, attribut_name)</span>
        
  </p>
  <p>  You call the 
  <span class="codefrag">woody</span> function from your sitemap to create a new form, for example:</p>
  <pre class="code">
  
     &lt;map:match pattern="form1.flow"&gt;
             &lt;map:call function="woody"&gt;
               &lt;map:parameter name="function" value="form1"/&gt;
               &lt;map:parameter name="form-definition" value="forms/form1.xml"/&gt;
               &lt;map:parameter name="attribute-name" value="form1"/&gt;
             &lt;/map:call&gt;
       &lt;/map:match&gt;
  </pre>
  <p>
  The <span class="codefrag">function</span> parameter specifies the name of a JavaScript function that will 
  provide the form's flow. The <span class="codefrag">form-definition</span> parameter specifies the 
  location of the Woody form definition of the form. The <span class="codefrag">attribute-name</span> 
  parameter specifies the name of a request attribute that will be used to 
  store the form. The specified function will be called with one 
  parameter, the newly created form.
        </p>
  <p>
    To use Woody in a Flowscript you must load <span class="codefrag">woody.js</span> into your script and define a function that takes one argument (<span class="codefrag">form1</span> in the example at the top of this page). The argument passed to your function will be a JavaScript representation of your Woody form.
    </p>
  </div>
  <a name="N10067"></a><a name="Form+Object"></a>
  <h4>Form Object</h4>
  <div style="margin-left: 0 ; border: 2px">
  <p>
    Woody provides a JavaScript <span class="codefrag">Form</span> object that provides methods for you to manage your form's <em>model</em> and to invoke its associated <em>view</em> and any validation you've specified.
    </p>
  <p>
      The <span class="codefrag">Form</span> object passed to your function has the following properties and functions:</p>
  <a name="N1007E"></a><a name="getModel-N1007C"></a>
  <h5>getModel</h5>
  <div style="margin-left: 0 ; border: 2px">
  <a name="getModel"></a>
  <p>
        
  <em>Function</em> <span class="codefrag">[Object] getModel()</span>
        
  </p>
  <p>
          Returns a JavaScript wrapper of the Woody <span class="codefrag">&lt;form&gt;</span> Widget.
        </p>
  </div>
  <a name="N10095"></a><a name="show-N10093"></a>
  <h5>show</h5>
  <div style="margin-left: 0 ; border: 2px">
  <a name="show"></a>
  <p>
        
  <em>Function</em> <span class="codefrag">show([String] uri, [Function] validator)</span>
        
  </p>
  <p>
         This method repeatedly shows the form until validation is complete. If 
         the <span class="codefrag">validator</span> function is supplied it will be called to do additional 
         validation.  The <span class="codefrag">validator</span> function will be called with one argument containing a 
         reference to the form.
        </p>
  </div>
  <a name="N100AF"></a><a name="getSubmitId-N100AD"></a>
  <h5>getSubmitId</h5>
  <div style="margin-left: 0 ; border: 2px">
  <a name="getSubmitId"></a>
  <p>
        
  <em>Function</em> <span class="codefrag">[String] getSubmitId()</span>
        
  </p>
  <p>
         Returns the id of the selected Woody <span class="codefrag">&lt;button&gt;</span> widget.
        </p>
  </div>
  <a name="N100C6"></a><a name="finish-N100C4"></a>
  <h5>finish</h5>
  <div style="margin-left: 0 ; border: 2px">
  <a name="finish"></a>
  <p>
        
  <em>Function</em> <span class="codefrag">finish()</span>
        
  </p>
  <p>
         Destroys this form and releases all of its resources.
        </p>
  </div>
  </div>
  </div>
   
  </div>
  </td><td width="10"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <!--================= end Content==================-->
  </table>
  </td>
  </tr>
  </table>
  <!--================= end Menu, NavBar, Content ==================-->
  <!--================= start Footer ==================-->
  <table summary="footer" cellspacing="0" cellpadding="0" width="100%" border="0">
  <tr>
  <td colspan="2" height="1" bgcolor="#4C6C8F"><img height="1" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"><a href="../../skin/images/label.gif"></a><a href="../../skin/images/page.gif"></a><a href="../../skin/images/chapter.gif"></a><a href="../../skin/images/chapter_open.gif"></a><a href="../../skin/images/current.gif"></a><a href="../..//favicon.ico"></a></td>
  </tr>
  <tr>
  <td colspan="2" bgcolor="#CFDCED" class="copyright" align="center"><font size="2" face="Arial, Helvetica, Sans-Serif">Copyright &copy;
            1999-2003&nbsp;The Apache Software Foundation. All rights reserved.<script type="text/javascript" language="JavaScript"><!--
                document.write(" - "+"Last Published: " + document.lastModified);
              //  --></script></font></td>
  </tr>
  <tr>
  <td colspan="2" align="left" bgcolor="#CFDCED" class="logos"></td>
  </tr>
  </table>
  <!--================= end Footer ==================-->
  </body>
  </html>
  
  
  
  1.1                  cocoon-site/site/2.1/userdocs/flow/woody.pdf
  
  	<<Binary file>>
  
  

Mime
View raw message