|
Emerging Technology
Fall Semester, 2004 Cocoon Forms |
|
|---|---|---|
|
© 2004, All Rights Reserved, SDSU & Roger Whitney San Diego State University -- This page last updated 23-Sep-04 |
CS 683 Emerging Technologies Fall Semester, 2004 Doc 13 Cocoon Form
formExample/resources/form.html
Copyright ©, All rights reserved. 2004 SDSU & Roger Whitney, 5500 Campanile Drive, San Diego, CA 92182-7700 USA. OpenContent ( http://www.opencontent.org/opl.shtml) license defines the copyright on this document.
| CS 683 Fall 04 | Doc 13, Cocoon Forms Slide # 2 |
Cocoon Developer’s Handbook, Moczar & Aston, Sams Publishing, 2003
| CS 683 Fall 04 | Doc 13, Cocoon Forms Slide # 3 |
Files
In CATALINA_HOME/webapps/cocoon/
formExample/content/age.xspformExample/resources/form.htmlformExample/style/main.xslformExample/sitemap.xmap
http://bismarck.sdsu.edu:9006/cocoon/age/index.html
| CS 683 Fall 04 | Doc 13, Cocoon Forms Slide # 4 |
<?xml version="1.0"?>
<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
<map:components>
<map:generators default="file" />
<map:transformers default="xslt" />
<map:readers default="resources" />
<map:serializers default="html" />
<map:selectors default="browser" />
<map:matchers default="wildcard" />
</map:components>
<map:pipelines>
<map:pipeline>
<map:match pattern="index.html">
<map:read type="resource"
src="resources/form.html" mime-type="text/html">
</map:read>
</map:match>
<map:match pattern="processAge.html">
<map:generate type="serverpages" src="content/age.xsp" />
<map:transform type="xslt" src="style/main.xsl" />
<map:serialize type="html" />
</map:match>
</map:pipeline>
</map:pipelines>
</map:sitemap>
| CS 683 Fall 04 | Doc 13, Cocoon Forms Slide # 5 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="content-type" content="text/html;
charset=iso-8859-1" />
<title>
Form Example
</title>
</head>
<body>
<h1>
Form Example
</h1>
<form action="processAge.html" method="get">
<label for="age">
Enter your age:
</label>
<input type="text" id="age" name="age" value="10"
size="40" />
<input type="submit" />
</form>
</body>
</html>
| CS 683 Fall 04 | Doc 13, Cocoon Forms Slide # 6 |
<?xml version="1.0"?>
<xsp:page language="java"
xmlns:xsp="http://apache.org/xsp"
xmlns:xsp-request="http://apache.org/xsp/request/2.0" >
<page>
<xsp:logic>
String ageString = <xsp-request:get-parameter name="age" />;
</xsp:logic>
<title>Age Results</title>
<content>
<paragraph>You entered: <xsp:expr>ageString</xsp:expr>
</paragraph>
</content>
</page>
</xsp:page>
| CS 683 Fall 04 | Doc 13, Cocoon Forms Slide # 7 |
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="page">
<html>
<head>
<title>
<xsl:value-of select="title"/>
</title>
</head>
<body>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>
<xsl:template match="title">
<h2>
<xsl:apply-templates/>
</h2>
</xsl:template>
<xsl:template match="paragraph">
<p>
<xsl:apply-templates/>
</p>
</xsl:template>
</xsl:stylesheet>
Copyright ©, All rights reserved.
2004 SDSU & Roger Whitney, 5500 Campanile Drive, San Diego, CA 92182-7700 USA.
OpenContent license defines the copyright on this document.