Output

The general pattern to produce output with Tapestry is this:

We call ${message} an expansion.

I am a message from the server, where the time is Sun Dec 01 19:38:15 UTC 2024.

Refresh
References: Expansions.

Home


<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_4.xsd">
<!-- 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. -->

<body class="container">
    <h3>Output</h3>

    <p>The general pattern to produce output with Tapestry is this:</p> 
    <ul>
        <li>Provide named properties (ie. provide public getters) in the class. For example, <code>getMessage()</code>.</li>
        <li>Reference the properties in the template. For example, <code><![CDATA[${message}]]></code>.</li>
    </ul>
    <p>We call <code><![CDATA[${message}]]></code> an <em>expansion</em>.</p>

    <div class="eg">
        <p>${message}</p>
        <t:pagelink t:page="examples/output/Output" href="#">Refresh</t:pagelink>
    </div>

    References: 
    <a href="http://tapestry.apache.org/component-templates.html#ComponentTemplates-Expansions">Expansions</a>.<br/><br/>

    <t:pagelink t:page="Index" href="#">Home</t:pagelink><br/><br/>

    <t:tabgroup>
        <t:sourcecodetab src="/web/src/main/java/jumpstart/web/pages/examples/output/Output.tml"/>
        <t:sourcecodetab src="/web/src/main/java/jumpstart/web/pages/examples/output/Output.java"/>
        <t:sourcecodetab src="/web/src/main/resources/META-INF/assets/css/examples/olive.css"/>
    </t:tabgroup>
</body>
</html>


package jumpstart.web.pages.examples.output;

import org.apache.tapestry5.annotations.Import;

@Import(stylesheet="css/examples/olive.css")
public class Output {

    public String getMessage() {
        return "I am a message from the server, where the time is " + new java.util.Date() + ".";
    }

}


.eg {
                margin: 20px 0;
                padding: 14px;
                color: olive;
                border: 1px solid #ddd;
                border-radius: 6px;
                -webkit-border-radius: 6px;
                -mox-border-radius: 6px;
}