Step 5: The Sitemap
Finally, the Sitemap pulls all of the previously created files
together into one understandable whole.
Within the components section of the sitemap, we add a map:action
element named HowToWizardAction. This points to the Java file
HowToWizardAction encountered during Step 4.
 |  |  |
 |
<!-- =========================== Components ================================ -->
<map:components>
<map:actions>
<map:action name="WizardAction"
src="org.apache.cocoon.samples.xmlform.WizardAction"
logger="webapp.xmlform"/>
<map:action name="HowtoWizardAction" src="org.apache.cocoon.samples.xmlform.howto.HowtoWizardAction"
logger="webapp.xmlform"/>
</map:actions>
<map:generators default="file"/>
<map:transformers default="xslt">
<map:transformer name="xmlform"
src="org.apache.cocoon.transformation.XMLFormTransformer"
logger="webapp.xmlform"/>
</map:transformers>
<map:readers default="resource"/>
<map:serializers default="html"/>
<map:selectors default="browser"/>
<map:matchers default="wildcard">
<map:matcher name="wildcard"
src="org.apache.cocoon.matching.WildcardURIMatcher"/>
</map:matchers>
</map:components>
|  |
 |  |  |
We then add the following to the pipeline.
 |  |  |
 |
<!-- A non-trivial example - Feedback HowTo Wizard -->
<map:match pattern="howto-wizard.html">
<map:act type="HowtoWizardAction">
<!-- XMLForm parameters for the HowtoWizardAction -->
<map:parameter name="xmlform-validator-schema-ns" value="http://www.ascc.net/xml/schematron"/>
<map:parameter name="xmlform-validator-schema" value="howto/schematron/howto-xmlform-sch-report.xml"/>
<map:parameter name="xmlform-id" value="form-feedback"/>
<map:parameter name="xmlform-scope" value="session"/>
<map:parameter name="xmlform-model" value="org.apache.cocoon.samples.xmlform.howto.HowToBean"/>
<!-- Content transformation logic -->
<map:generate src="howto/{page}.xml"/>
<map:transform type="xmlform" label="xml"/>
<map:transform src="stylesheets/wizard2html.xsl"/>
<map:transform src="context://stylesheets/xmlform/xmlform2html.xsl"/>
<map:serialize type="html"/>
</map:act>
</map:match>
|  |
 |  |  |
The whole sitemap.xmap is found below. You can simply copy and past
it into your own sitemap. Your current sitemap is located in
\src\webapp\samples\xmlform.
 |  |  |
 |
<?xml version="1.0"?>
<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
<!-- =========================== Components ================================ -->
<map:components>
<map:actions>
<map:action name="WizardAction"
src="org.apache.cocoon.samples.xmlform.WizardAction"
logger="webapp.xmlform"/>
<map:action name="HowtoWizardAction" src="org.apache.cocoon.samples.xmlform.howto.HowtoWizardAction"
logger="webapp.xmlform"/>
</map:actions>
<map:generators default="file"/>
<map:transformers default="xslt">
<map:transformer name="xmlform" src="org.apache.cocoon.transformation.XMLFormTransformer"
logger="webapp.xmlform"/>
</map:transformers>
<map:readers default="resource"/>
<map:serializers default="html"/>
<map:selectors default="browser"/>
<map:matchers default="wildcard">
<map:matcher name="wildcard" src="org.apache.cocoon.matching.WildcardURIMatcher"/>
</map:matchers>
</map:components>
<!-- =========================== Resources ================================= -->
<map:resources>
</map:resources>
<!-- =========================== Pipelines ================================= -->
<map:pipelines>
<map:pipeline>
<map:match pattern="">
<map:redirect-to uri="wizard.html"/>
</map:match>
<!-- A non-trivial example - Feedback Wizard -->
<map:match pattern="wizard.html">
<map:act type="WizardAction">
<!-- XMLForm parameters for the AbstractXMLFormAction -->
<map:parameter name="xmlform-validator-schema-ns" value="http://www.ascc.net/xml/schematron"/>
<map:parameter name="xmlform-validator-schema" value="schematron/wizard-xmlform-sch-report.xml"/>
<map:parameter name="xmlform-id" value="form-feedback"/>
<map:parameter name="xmlform-scope" value="session"/>
<map:parameter name="xmlform-model" value="org.apache.cocoon.samples.xmlform.UserBean"/>
<!-- Content transformation logic -->
<map:generate src="wizard/{page}.xml"/>
<map:transform type="xmlform" label="xml"/>
<map:transform src="stylesheets/wizard2html.xsl"/>
<map:transform src="context://stylesheets/xmlform/xmlform2html.xsl"/>
<map:serialize type="html"/>
</map:act>
</map:match>
<!-- A non-trivial example - Feedback HowTo Wizard -->
<map:match pattern="howto-wizard.html">
<map:act type="HowtoWizardAction">
<!-- XMLForm parameters for the HowtoWizardAction -->
<map:parameter name="xmlform-validator-schema-ns" value="http://www.ascc.net/xml/schematron"/>
<map:parameter name="xmlform-validator-schema" value="howto/schematron/howto-xmlform-sch-report.xml"/>
<map:parameter name="xmlform-id" value="form-howto"/>
<map:parameter name="xmlform-scope" value="session"/>
<map:parameter name="xmlform-model" value="org.apache.cocoon.samples.xmlform.howto.HowToBean"/>
<!-- Content transformation logic -->
<map:generate src="howto/{page}.xml"/>
<map:transform type="xmlform" label="xml"/>
<map:transform src="stylesheets/wizard2html.xsl"/>
<map:transform src="context://stylesheets/xmlform/xmlform2html.xsl"/>
<map:serialize type="html"/>
</map:act>
</map:match>
</map:pipeline>
</map:pipelines>
</map:sitemap>
<!-- end of file -->
|  |
 |  |  |
Congratulations! You have just covered everything you need to know to
create the mailing list forms. Now all you need to do is to build and
then deploy the files on your web server.
To build your webapp, use the command:
 |  |  |
 |
build webapp -Dinclude.webapp.libs=true webapp
|  |
 |  |  |
If you are using Tomcat, for example, place cocoon.war in your
webapps folder and then restart Tomcat.
In a browser go to
http://localhost:8080/cocoon/samples/xmlform/howto-wizard.html. You
should see the start page of the mailing list forms.
Return to the overview page.
|