tapestry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache Tapestry > Page And Component Classes
Date Mon, 16 Aug 2010 01:22:00 GMT
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/1810/9/8/_/styles/combined.css?spaceKey=TAPESTRY&amp;forWysiwyg=true"
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://cwiki.apache.org/confluence/display/TAPESTRY/Page+And+Component+Classes">Page
And Component Classes</a></h2>
    <h4>Page  <b>added</b> by             <a href="https://cwiki.apache.org/confluence/display/~hlship">Howard
M. Lewis Ship</a>
    <div class="notificationGreySide">
         <h1><a name="PageAndComponentClasses-What%27sthedifferencebetweenapageandacomponent%3F"></a>What's
the difference between a page and a component?</h1>

<p>There's very little difference between the two. Pages clases must be in the <em>root-package</em>.<tt>pages</tt>
package; components must be in the<br/>
<em>root-package</em>.<tt>components</tt>.  Pages may provide event
handlers for certain page-specific events (such as activate and passivate).  Components may
have parameters.</p>

<p>Other than that, they are more equal than they are different. They may have templates
or may render themselves in code (pages usually have a template, components are more likely
to render only in code).</p>

<p>The major difference is that Tapestry page templates may be stored in the web context
directory, as if they were static files (they can't be accessed from the client however; a
specific rule prevents access to files with the <tt>.tml</tt> extension).</p>

<div class='panelMacro'><table class='warningMacro'><colgroup><col width='24'><col></colgroup><tr><td
valign='top'><img src="/confluence/images/icons/emoticons/forbidden.gif" width="16"
height="16" align="absmiddle" alt="" border="0"></td><td>It is possible that
this feature may be removed in a later release. It is preferred that page templates be stored
on the classpath, like component templates.</td></tr></table></div>

<h1><a name="PageAndComponentClasses-HowdoIstoremypageclassesinadifferentpackage%3F"></a>How
do I store my page classes in a different package?</h1>

<p>Tapestry is very rigid here; you can't. Page classes must go in <em>root-package</em>.<tt>pages</tt>,
component classes in <em>root-package</em>.<tt>components</tt>, etc.</p>

<h1><a name="PageAndComponentClasses-Whydomyinstancevariableshavetobeprivate%3F"></a>Why
do my instance variables have to be private?</h1>

<p>Tapestry does a large amount of transformation to your simple POJO classes as it
loads them into memory. In many cases, it must locate every read or write of an instance variable
and change its behavior; for example, reading a field that is a component parameter will<br/>
cause a property of the containing page or component to be read.</p>

<p>Limiting fields to private means that Tapestry can do the necessary processing one
class at a time, as needed, at runtime. More complex<br/>
Aspect Orient Programming systems such as AspectJ can perform similar transformations (and
much more complex ones), but requires a dedicated build step (or the introduction of a JVM
    <div id="commentsSection" class="wiki-content pageSection">
       <div style="float: right;">
            <a href="https://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
       <a href="https://cwiki.apache.org/confluence/display/TAPESTRY/Page+And+Component+Classes">View

View raw message