You are viewing a plain text version of this content. The canonical link for it is here.
Posted to docs@cocoon.apache.org by da...@cocoon.zones.apache.org on 2005/10/14 15:53:59 UTC

[DAISY] Updated: How to develop Web Applications

A document has been updated:

http://cocoon.zones.apache.org/daisy/legacydocs/631.html

Document ID: 631
Branch: main
Language: default
Name: How to develop Web Applications (unchanged)
Document Type: Document (unchanged)
Updated on: 10/14/05 1:53:37 PM
Updated by: Helma van der Linden

A new version has been created, state: publish

Parts
=====
Content
-------
This part has been updated.
Mime type: text/xml (unchanged)
File name:  (unchanged)
Size: 46339 bytes (previous version: 46293 bytes)
Content diff:
(27 equal lines skipped)
    webapp as per the installation instructions (<tt>build webapp</tt>) then you can
    see this tutorial in action via the Samples pages.</p>
    
+++ <p class="note">Screenshots are <a href="daisy:633">here</a>.</p>
+++ 
    <h2>Separating Concerns</h2>
    
    <p>Cocoon is designed to allow Developers, Business Analysts, Designers, and
(132 equal lines skipped)
    the <tt>&lt;map:pipelines&gt;</tt> tag. Next, you will add an entry in the same
    location that looks like this:</p>
    
--- <pre>
---   
+++ <pre>  
    &lt;map:pipeline&gt;
       &lt;map:match pattern=""&gt;
         &lt;map:redirect-to uri="home.html"/&gt;
(56 equal lines skipped)
    <p>Our home page is going to be really simple: a list of links that take us to
    the main pages.</p>
    
--- <pre>
---   
+++ <pre>  
    &lt;document&gt;
      &lt;header&gt;
        &lt;title&gt;Home Page&lt;/title&gt;
(54 equal lines skipped)
    <p>Our first form is the "Create a Department" form. The website specification
    is missing the tags for form building, we will provide an example here:</p>
    
--- <pre>
---   
+++ <pre>  
    &lt;document&gt;
      &lt;header&gt;
        &lt;title&gt;Department&lt;/title&gt;
(37 equal lines skipped)
    database tables and place constraints on the parameters. For the Department form
    group, it will look like this:</p>
    
--- <pre>
---   
+++ <pre>  
    &lt;root&gt;
      &lt;!-
          The "parameter" elements identify the root constraints for
(73 equal lines skipped)
    has to be able to know how to reference the Actions we want. To do that, alter
    the "map:actions" section to list all the actions we need:</p>
    
--- <pre>
---   
+++ <pre>  
    &lt;map:actions&gt;
       &lt;map:action name="dbAdd"
                   src="org.apache.cocoon.acting.DatabaseAddAction"/&gt;
(14 equal lines skipped)
    parameter. For our purposes, the action set we are defining is listed below
    (defined in the sitemap):</p>
    
--- <pre>
---   
+++ <pre>  
    &lt;map:action-sets&gt;
      &lt;map:action-set name="process"&gt;
       &lt;map:act type="form" action="Create Department"&gt;
(13 equal lines skipped)
    <p>Now that we have defined the actions we want, with the parameters that
    control them during run-time, we can use it in our pipeline.</p>
    
--- <pre>
---   
+++ <pre>  
    &lt;map:match pattern="*-dept.html"&gt;
      &lt;map:act set="process"&gt;
        &lt;map:parameter name="descriptor"
(39 equal lines skipped)
    document called "xsp:page" declaring the XSP namespace. The change will look
    like this:</p>
    
--- <pre>
---   
+++ <pre>  
    &lt;xsp:page xmlns:xsp="http://apache.org/xsp"&gt;
      &lt;!-- The original document will be embedded here --&gt;
    &lt;/xsp:page&gt;
(4 equal lines skipped)
    we know what we are dealing with at a glance. Create a new file called
    "confirm.xsp" with the following contents:</p>
    
--- <pre>
---   
+++ <pre>  
    &lt;xsp:page xmlns:xsp="http://apache.org/xsp"&gt;
    &lt;document&gt;
      &lt;header&gt;
(17 equal lines skipped)
    namespace declaration to the "xsp:page" element. The final form page will look
    like this:</p>
    
--- <pre>
---   
+++ <pre>  
    &lt;xsp:page xmlns:xsp="http://apache.org/xsp"
              xmlns:xsp-formval="http://apache.org/xsp/form-validator/2.0"&gt;
    &lt;document&gt;
(36 equal lines skipped)
    accomplish with the ESQL Logicsheet. Again, when you use the ESQL logicsheet,
    you lose some of your separation of concerns.</p>
    
--- <pre>
---   
+++ <pre>  
    &lt;xsp:page xmlns:xsp="http://apache.org/xsp"
              xmlns:xsp-formval="http://apache.org/xsp/form-validator/2.0"
              xmlns:esql="http://apache.org/cocoon/SQL/v2"&gt;
(144 equal lines skipped)
    Actions. When an Action is specified in the sitemap, it uses the following
    syntax:</p>
    
--- <pre>
---   
+++ <pre>  
    &lt;map:act type="my-action"&gt;
      &lt;map:generate src="{source}"/&gt;
      &lt;map:transform src="doc2{theme}"/&gt;
(54 equal lines skipped)
    
    <p>The resulting XML looks like this:</p>
    
--- <pre>
---   
+++ <pre>  
    &lt;?xml version="1.0"?&gt;
    
    &lt;directory xmlns="http://apache.org/cocoon/directory/2.0"
(71 equal lines skipped)
    <p>This generator converts the Request object into an XML representation. It is
    best used for debugging purposes. The resulting XML follows:</p>
    
--- <pre>
---   
+++ <pre>  
    &lt;request xmlns="http://apache.org/cocoon/request/2.0"
             target="index.html" source="context://docs/index.xml"&gt;
    
(28 equal lines skipped)
    interpreter to generate valid XML. If you add language support, you will have to
    embed the following configuration information:</p>
    
--- <pre>
---   
+++ <pre>  
    &lt;add-languages&gt;
      &lt;!-- repeat the following for each language: --&gt;
      &lt;language name="kawa-scheme"
(25 equal lines skipped)
    <p>The StatusGenerator is another debug tool. It provides status information for
    the Cocoon engine. The resultant XML is in the following format:</p>
    
--- <pre>
---   
+++ <pre>  
    &lt;statusinfo xmlns="http://apache.org/cocoon/status/2.0"
                xmlns:xlink="http://www.w3.org/1999/xlink"
                host="johnny-bravo.infoplanning.com"
(57 equal lines skipped)
    sitemap so you can include the results of processed XSP pages. An example
    follows:</p>
    
--- <pre>
---   
+++ <pre>  
    &lt;document xmlns:ci="http://apache.org/cocoon/include/1.0"&gt;
      &lt;ci:include src="cocoon://my-resource.xml"
                  element="body"
(50 equal lines skipped)
    the "i18n:text" element, or the attribute name inside the "i18n:attr" attribute.
    </p>
    
--- <pre>
---   
+++ <pre>  
    &lt;document xmlns:i18n="http://apache.org/cocoon/i18n/2.0"&gt;
      &lt;body&gt;
        &lt;s1 title="Test Title" i18n:attr="title"&gt;
(33 equal lines skipped)
    
    <p>Below is the root element of all sitemaps:</p>
    
--- <pre>
---   
+++ <pre>  
    &lt;map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0"&gt;
    &lt;/map:sitemap&gt;
      
(6 equal lines skipped)
    what they do. Before we begin, I must state that every component is declared in
    the "map:components" element of the Sitemap:</p>
    
--- <pre>
---   
+++ <pre>  
    &lt;map:components&gt;
    &lt;/map:components&gt;
      
(4 equal lines skipped)
    <p>All generators are declared within the "map:generators" element that is a
    child of the "map:components" element:</p>
    
--- <pre>
---   
+++ <pre>  
    &lt;map:generators&gt;
      &lt;map:generator name="file"
                     src="org.apache.cocoon.generation.FileGenerator"/&gt;
(16 equal lines skipped)


Fields
======
no changes

Links
=====
no changes

Custom Fields
=============
no changes

Collections
===========
no changes