MarkupWriter

Instead of rendering from a template, a page or component can render a DOM directly with
Tapestry's MarkupWriter as described here.
For components that need a lot of control over the sequence of output it can be easier to use than a template.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!-- We need a doctype to allow us to use special characters like &nbsp;
We use a "strict" DTD to make IE follow the alignment rules. -->
<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_4.xsd">
<body class="container">
<h3>MarkupWriter</h3>
Instead of rendering from a <em>template</em>, a page or component can render a DOM directly with
Tapestry's <em>MarkupWriter</em> as described <a href="http://tapestry.apache.org/dom.html">here</a>.<br/>
For components that need a lot of control over the sequence of output it can be easier to use than a template.<br/><br/>
A really simple example is Tapestry's
<a href="http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/TextField.java?view=markup">
TextField</a> component, but its superclass
<a href="http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/base/AbstractTextField.java?view=markup">
AbstractTextField</a> does most of the work.<br/><br/>
Two more examples are JumpStart's SourceCodeDisplay (used by SourceCodeTab) and JodaTimeOutput components. Their source is below.<br/><br/>
References:
<a href="http://tapestry.apache.org/dom.html">DOM</a>,
<a href="http://tapestry.apache.org/5.4/apidocs/org/apache/tapestry5/MarkupWriter.html">MarkupWriter</a>.<br/><br/>
<t:pagelink page="Index">Home</t:pagelink><br/><br/>
<t:tabgroup>
<t:sourcecodetab src="/web/src/main/java/jumpstart/web/pages/examples/component/MarkupWriter.tml"/>
<t:sourcecodetab src="/web/src/main/java/jumpstart/web/pages/examples/component/MarkupWriter.java"/>
<t:sourcecodetab src="/web/src/main/java/jumpstart/web/components/SourceCodeDisplay.java"/>
<t:sourcecodetab src="/web/src/main/resources/META-INF/assets/css/sourcecodedisplay.css"/>
<t:sourcecodetab src="/web/src/main/java/jumpstart/web/components/JodaTimeOutput.java"/>
</t:tabgroup>
</body>
</html>