You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by bu...@apache.org on 2017/04/09 11:20:04 UTC

svn commit: r1010098 - in /websites/production/tapestry/content: cache/main.pageCache component-classes.html

Author: buildbot
Date: Sun Apr  9 11:20:04 2017
New Revision: 1010098

Log:
Production update by buildbot for tapestry

Modified:
    websites/production/tapestry/content/cache/main.pageCache
    websites/production/tapestry/content/component-classes.html

Modified: websites/production/tapestry/content/cache/main.pageCache
==============================================================================
Binary files - no diff available.

Modified: websites/production/tapestry/content/component-classes.html
==============================================================================
--- websites/production/tapestry/content/component-classes.html (original)
+++ websites/production/tapestry/content/component-classes.html Sun Apr  9 11:20:04 2017
@@ -45,13 +45,26 @@
 
   <div class="wrapper bs">
 
-        <div id="navigation"><div class="nav"><ul class="alternate"><li><a  href="index.html">Home</a></li><li><a  href="getting-started.html">Getting Started</a></li><li><a  href="documentation.html">Documentation</a></li><li><a  href="download.html">Download</a></li><li><a  href="about.html">About</a></li><li><a  class="external-link" href="http://www.apache.org/licenses/LICENSE-2.0">License</a></li><li><a  href="community.html">Community</a></li><li><a  class="external-link" href="http://www.apache.org/security/">Security</a></li><li><a  class="external-link" href="http://www.apache.org/">Apache</a></li><li><a  class="external-link" href="http://www.apache.org/foundation/sponsorship.html">Sponsorship</a></li><li><a  class="external-link" href="http://www.apache.org/foundation/thanks.html">Thanks</a></li></ul></div></div>
+        <div id="navigation"><div class="nav"><ul class="alternate"><li><a  href="index.html">Home</a></li><li><a  href="getting-started.html">Getting Started</a></li><li><a  href="documentation.html">Documentation</a></li><li><a  href="download.html">Download</a></li><li><a  href="about.html">About</a></li><li><a  class="external-link" href="http://www.apache.org/licenses/LICENSE-2.0">License</a></li><li><a  href="community.html">Community</a></li><li><a  class="external-link" href="http://www.apache.org/security/">Security</a></li><li><a  class="external-link" href="http://www.apache.org/">Apache</a></li><li><a  class="external-link" href="http://www.apache.org/foundation/sponsorship.html">Sponsorship</a></li><li><a  class="external-link" href="http://www.apache.org/foundation/thanks.html">Thanks</a></li></ul></div>
+
+</div>
 
           <div id="top">
-            <div id="smallbanner"><div class="searchbox" style="float:right;margin: .3em 1em .1em 1em"><span style="color: #999; font-size: 90%">Tapestry docs, issues, wikis &amp; blogs:</span><form enctype="application/x-www-form-urlencoded" method="get" action="http://tapestry.apache.org/search.html"> 
- <input type="text" name="q"> 
- <input type="submit" value="Search"> 
-</form></div><div class="emblem" style="float:left"><p><a  href="index.html"><span class="confluence-embedded-file-wrapper"><img class="confluence-embedded-image confluence-external-resource" src="http://tapestry.apache.org/images/tapestry_small.png" data-image-src="http://tapestry.apache.org/images/tapestry_small.png"></span></a></p></div><div class="title" style="float:left; margin: 0 0 0 3em"><h1 id="SmallBanner-PageTitle">Component Classes</h1></div></div>
+            <div id="smallbanner"><div class="searchbox" style="float:right;margin: .3em 1em .1em 1em"><span style="color: #999; font-size: 90%">Tapestry docs, issues, wikis &amp; blogs:</span>
+<form enctype="application/x-www-form-urlencoded" method="get" action="http://tapestry.apache.org/search.html">
+  <input type="text" name="q">
+  <input type="submit" value="Search">
+</form>
+
+</div>
+
+
+<div class="emblem" style="float:left"><p><a  href="index.html"><span class="confluence-embedded-file-wrapper"><img class="confluence-embedded-image confluence-external-resource" src="http://tapestry.apache.org/images/tapestry_small.png" data-image-src="http://tapestry.apache.org/images/tapestry_small.png"></span></a></p></div>
+
+
+<div class="title" style="float:left; margin: 0 0 0 3em"><h1 id="SmallBanner-PageTitle">Component Classes</h1></div>
+
+</div>
       <div class="clearer"></div>
       </div>
 
@@ -63,43 +76,76 @@
       </div>
 
       <div id="content">
-                <div id="ConfluenceContent"><p>A <strong>component class</strong>&#160;is the class associated with a page, component or mixin in your Tapestry web application. Classes for pages, components and mixins are all created in an identical way. They are pure POJOs (Plain Old Java Objects), typically with annotations and conventionally named methods. They are not <em>abstract</em>, nor do they need to extend base classes or implement interfaces.</p><div class="aui-label" style="float:right" title="Related Articles"><h3>Related Articles</h3><ul class="content-by-label"><li> 
-  <div> 
-   <span class="icon aui-icon aui-icon-small aui-iconfont-page-default" title="Page">Page:</span> 
-  </div> 
-  <div class="details"> 
-   <a  href="component-reference.html">Component Reference</a> 
-  </div> </li><li> 
-  <div> 
-   <span class="icon aui-icon aui-icon-small aui-iconfont-page-default" title="Page">Page:</span> 
-  </div> 
-  <div class="details"> 
-   <a  href="component-libraries.html">Component Libraries</a> 
-  </div> </li><li> 
-  <div> 
-   <span class="icon aui-icon aui-icon-small aui-iconfont-page-default" title="Page">Page:</span> 
-  </div> 
-  <div class="details"> 
-   <a  href="page-and-component-classes-faq.html">Page And Component Classes FAQ</a> 
-  </div> </li><li> 
-  <div> 
-   <span class="icon aui-icon aui-icon-small aui-iconfont-page-default" title="Page">Page:</span> 
-  </div> 
-  <div class="details"> 
-   <a  href="component-templates.html">Component Templates</a> 
-  </div> </li><li> 
-  <div> 
-   <span class="icon aui-icon aui-icon-small aui-iconfont-page-default" title="Page">Page:</span> 
-  </div> 
-  <div class="details"> 
-   <a  href="component-cheat-sheet.html">Component Cheat Sheet</a> 
-  </div> </li><li> 
-  <div> 
-   <span class="icon aui-icon aui-icon-small aui-iconfont-page-default" title="Page">Page:</span> 
-  </div> 
-  <div class="details"> 
-   <a  href="component-parameters.html">Component Parameters</a> 
-  </div> </li></ul></div><p>In most cases, each component class will have a corresponding <a  href="component-templates.html">component template</a>. However, it is also possible for a component class to emit all of its markup itself, without using a template.</p><p><em>For Tapestry 4 Users: Component classes in Tapestry 5 are much easier than in Tapestry 4. There are no base classes to extend from, the classes are concrete (not abstract), and there's no XML file. There is still a bit of configuration in the form of Java annotations, but those now go directly onto fields of your class, rather than on abstract getters and setters.</em></p><h2 id="ComponentClasses-CreatingaTrivialComponent">Creating a Trivial Component</h2><p>Creating a page or component in Tapestry 5 is a breeze. There are only a few constraints:</p><ul><li>There must be a public Java class.</li><li>The class must be in the correct package (see below).</li><li>The class must have a public, no-arguments constructor. (
 The default one provided by the compiler is fine.)</li></ul><p>Here's a minimal component that outputs a fixed message, using a <a  href="component-templates.html">template</a> with a matching file name:</p><div class="sectionColumnWrapper"><div class="sectionMacro"><div class="sectionMacroRow"><div class="columnMacro"><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>HelloWorld.java</b></div><div class="codeContent panelContent pdl">
+                <div id="ConfluenceContent"><p>A <strong>component class</strong>&#160;is the class associated with a page, component or mixin in your Tapestry web application. Classes for pages, components and mixins are all created in an identical way. They are pure POJOs (Plain Old Java Objects), typically with annotations and conventionally named methods. They are not <em>abstract</em>, nor do they need to extend base classes or implement interfaces.</p><div class="aui-label" style="float:right" title="Related Articles">
+
+
+
+
+
+
+
+
+<h3>Related Articles</h3>
+
+<ul class="content-by-label"><li>
+        <div>
+                <span class="icon aui-icon aui-icon-small aui-iconfont-page-default" title="Page">Page:</span>        </div>
+
+        <div class="details">
+                        <a  href="component-reference.html">Component Reference</a>
+                
+                        
+                    </div>
+    </li><li>
+        <div>
+                <span class="icon aui-icon aui-icon-small aui-iconfont-page-default" title="Page">Page:</span>        </div>
+
+        <div class="details">
+                        <a  href="component-libraries.html">Component Libraries</a>
+                
+                        
+                    </div>
+    </li><li>
+        <div>
+                <span class="icon aui-icon aui-icon-small aui-iconfont-page-default" title="Page">Page:</span>        </div>
+
+        <div class="details">
+                        <a  href="page-and-component-classes-faq.html">Page And Component Classes FAQ</a>
+                
+                        
+                    </div>
+    </li><li>
+        <div>
+                <span class="icon aui-icon aui-icon-small aui-iconfont-page-default" title="Page">Page:</span>        </div>
+
+        <div class="details">
+                        <a  href="component-templates.html">Component Templates</a>
+                
+                        
+                    </div>
+    </li><li>
+        <div>
+                <span class="icon aui-icon aui-icon-small aui-iconfont-page-default" title="Page">Page:</span>        </div>
+
+        <div class="details">
+                        <a  href="component-cheat-sheet.html">Component Cheat Sheet</a>
+                
+                        
+                    </div>
+    </li><li>
+        <div>
+                <span class="icon aui-icon aui-icon-small aui-iconfont-page-default" title="Page">Page:</span>        </div>
+
+        <div class="details">
+                        <a  href="component-parameters.html">Component Parameters</a>
+                
+                        
+                    </div>
+    </li></ul>
+</div>
+
+
+<p>In most cases, each component class will have a corresponding <a  href="component-templates.html">component template</a>. However, it is also possible for a component class to emit all of its markup itself, without using a template.</p><p><em>For Tapestry 4 Users: Component classes in Tapestry 5 are much easier than in Tapestry 4. There are no base classes to extend from, the classes are concrete (not abstract), and there's no XML file. There is still a bit of configuration in the form of Java annotations, but those now go directly onto fields of your class, rather than on abstract getters and setters.</em></p><h2 id="ComponentClasses-CreatingaTrivialComponent">Creating a Trivial Component</h2><p>Creating a page or component in Tapestry 5 is a breeze. There are only a few constraints:</p><ul><li>There must be a public Java class.</li><li>The class must be in the correct package (see below).</li><li>The class must have a public, no-arguments constructor. (The default one provided 
 by the compiler is fine.)</li></ul><p>Here's a minimal component that outputs a fixed message, using a <a  href="component-templates.html">template</a> with a matching file name:</p><div class="sectionColumnWrapper"><div class="sectionMacro"><div class="sectionMacroRow"><div class="columnMacro"><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>HelloWorld.java</b></div><div class="codeContent panelContent pdl">
 <pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;">package org.example.myapp.components;
 public class HelloWorld
 {
@@ -125,11 +171,13 @@ public class HelloWorld
     }
 }
 </pre>
-</div></div><p>In this example, just like the first one, the component's only job is to write out a fixed message. The @<a  class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/annotations/BeginRender.html">BeginRender</a> annotation is a type of <em><a  href="component-rendering.html">render phase annotation</a></em>, a method annotation that instructs Tapestry when and under what circumstances to invoke methods of your class.</p><p>These methods are not necessarily public; they can have any access level you like (unlike in Tapestry 4). By convention they usually have package-private access level (the default).</p><h2 id="ComponentClasses-ComponentPackages">Component Packages</h2><p>Component classes must exist within an appropriate package (this is necessary for runtime code transformation and class reloading to operate).</p><p>These packages exist under the application's root package, as follows:</p><ul><li>For pages, place classes in <em>ro
 ot</em>.<strong>pages</strong>. Page names are mapped to classes within this package.</li><li>For mixins, place classes in <em>root</em>.<strong>mixins</strong>. Mixin types are mapped to classes within this package.</li><li>For other components, place classes in <em>root</em>.<strong>components</strong>. Component types are mapped to classes within this package.</li></ul><p>In addition, it is common for an application to have base classes, often <em>abstract</em> base classes, that should not be directly referenced. These should <em>not</em> go in the <strong>pages</strong>, <strong>components</strong> or <strong>mixins</strong> packages, because they then look like valid pages, components or mixins. Instead, use the <em>root</em>.<strong>base</strong> package to store such base classes.</p><div class="confluence-information-macro confluence-information-macro-warning"><span class="aui-icon aui-icon-small aui-iconfont-error confluence-information-macro-icon"></span><div class="confl
 uence-information-macro-body"><p>Only component classes should go in any of these controlled packages; classes representing data, or interfaces, or anything that isn't precisely a component class, must go elsewhere. Any top-level class in any of the controlled packages will be transformed at runtime. The only exception is inner classes<br clear="none"> (anonymous or not), which are loaded by the same class loader as the component class loader, but not transformed as components.</p></div></div><h2 id="ComponentClasses-Sub-Folders/Sub-Packages">Sub-Folders / Sub-Packages</h2><p>Classes do not have to go directly inside the package (pages, components, mixins, etc.). It is valid to create a sub-package to store some of the classes. The sub-package name becomes part of the page name or component type. Thus you might define a page component <code>com.example.myapp.pages.admin.CreateUser</code> and the logical page name (which often shows up inside URLs) will be <strong>admin/CreateUser</s
 trong>.</p><p>Tapestry performs some simple optimizations of the logical page name (or component type, or mixin type). It checks to see if the package name is either a prefix or a suffix of the unqualified class name (case insensitively, of course) and removes the prefix or suffix if so. The net result is that a class name such as <code>com.example.myapp.pages.user.EditUser</code> will have a page name of <code>user/Edit</code> (<em>not</em> <code>user/EditUser</code>). The goal here is to provide shorter, more natural URLs.</p><h2 id="ComponentClasses-IndexPages">Index Pages</h2><p>One special simplification are Index pages: if the logical page name is Index after removing the package name from the unqualified class name, it will map to the root of that folder. A class such as <code>com.example.myapp.pages.user.IndexUser</code> or <code>com.example.myapp.pages.user.UserIndex</code> will have a page name of <code>user/</code>.</p><p>In previous versions of Tapestry there was also th
 e concept of a start page configured with the <code><a  href="configuration.html">tapestry.start-page-name</a></code> configuration symbol (defaults to "start"). If a page with a name as configured with that symbol exists at the root level, this page is used as the root URL. This has precedence over an existing Index page. If for example you have a page class <code>com.example.myapp.pages.Start</code> it will map to <code>/</code>.</p><div class="confluence-information-macro confluence-information-macro-warning"><span class="aui-icon aui-icon-small aui-iconfont-error confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>Use of start-pages is discouraged and support for it will eventually be removed. Use an Index page instead.</p></div></div><h2 id="ComponentClasses-Pagesvs.Components">Pages vs. Components</h2><p>The distinction between pages and component is very, very small. The only real difference is the package name: <em>root</em>.<strong>pa
 ges</strong>.<em>PageName</em> for pages, and <em>root</em>.<strong>components</strong>.<em>ComponentType</em> for components. Conceptually, page components are simply the <em>root component</em> of a page's component tree.</p><p><em>For Tapestry 4 users: there was a much greater distinction in Tapestry 4 between pages and components, which showed up as separate interfaces and a hierarchy of abstract implementations to extend your classes from.</em></p><h2 id="ComponentClasses-ClassTransformation">Class Transformation</h2><p>Tapestry uses your class as a starting point. It <em>transforms</em> your class at runtime. This is necessary for a number of reasons, including to address how Tapestry shares pages between requests.</p><p>For the most part, these transformations are both sensible and invisible. In a few limited cases, they are marginally <a  class="external-link" href="http://www.joelonsoftware.com/printerFriendly/articles/LeakyAbstractions.html" rel="nofollow">leaky</a> &#8211
 ; for instance, the scope restrictions on instance variables described below &#8211; but we feel that the programming model in general will support very high levels of developer productivity.</p><p>Because transformation doesn't occur until <em>runtime</em>, the build stage of your application is not affected by the fact that you are creating a Tapestry application. Further, your classes are absolutely simple POJOs during unit testing.</p><h2 id="ComponentClasses-LiveClassReloading">Live Class Reloading</h2><p>Main Article: <a  href="class-reloading.html">Class Reloading</a></p><p>Component classes are monitored for changes by the framework. <a  href="class-reloading.html">Classes are reloaded when changed</a>. This allows you to build your application with a speed approaching that of a scripting environment, without sacrificing any of the power of the Java platform.</p><p>And it's fast! You won't even notice that this magic class reloading has occurred.</p><p>The net result: super 
 productivity &#8212; change your class, see the change instantly. This is designed to be a blend of the best of scripting environments (such as Python or Ruby) with all the speed and power of Java backing it up.</p><p>However, class reloading <em>only</em> applies to component classes (pages, components and mixins) and, starting in 5.2, Tapestry IOC-based service implementations (with some restrictions). Other classes, such as service interfaces, entity/model classes, and other data objects, are loaded by the normal class loader and not subject to live class reloading.</p><h2 id="ComponentClasses-InstanceVariables">Instance Variables</h2><p>Tapestry components may have instance variables (unlike Tapestry 4, where you had to use <em>abstract properties</em>).</p><p>Since release 5.3.2, instance variables may be protected, or package private (that is, no access modifier). Under specific circumstances they may even be public (public fields must either be final, or have the @<a  class="
 external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/annotations/Retain.html">Retain</a>&#160;annotation).</p><p><span style="line-height: 1.4285715;">Be aware that you will need to provide getter and setter methods to access your classes' instance variables. Tapestry </span><em style="line-height: 1.4285715;">does not</em><span style="line-height: 1.4285715;"> do this automatically unless you provide the @</span><a  class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/annotations/Property.html" style="line-height: 1.4285715;">Property</a><span style="line-height: 1.4285715;"> annotation on the field.</span></p><h2 id="ComponentClasses-TransientInstanceVariables">Transient Instance Variables</h2><p>Unless an instance variable is decorated with an annotation, it will be a <em>transient</em> instance variable. This means that its value resets to its default value at the end of reach request (when the <a  href="page
 -life-cycle.html">page is detached from the request</a>).</p><div class="confluence-information-macro confluence-information-macro-note"><p class="title">About initialization</p><span class="aui-icon aui-icon-small aui-iconfont-warning confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>Never initialize an instance field to a <em>mutable</em> object at the point of declaration. If this is done, the instance created from that initializer becomes the default value for that field and is reused inside the component on every request. This could cause state to inadvertently be shared between different sessions in an application.</p></div></div>
+</div></div><p>In this example, just like the first one, the component's only job is to write out a fixed message. The @<a  class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/annotations/BeginRender.html">BeginRender</a> annotation is a type of <em><a  href="component-rendering.html">render phase annotation</a></em>, a method annotation that instructs Tapestry when and under what circumstances to invoke methods of your class.</p><p>These methods are not necessarily public; they can have any access level you like (unlike in Tapestry 4). By convention they usually have package-private access level (the default).</p><h2 id="ComponentClasses-ComponentPackages">Component Packages</h2><p>Component classes must exist within an appropriate package (this is necessary for runtime code transformation and class reloading to operate).</p><p>These packages exist under the application's root package, as follows:</p><ul><li>For pages, place classes in <em>ro
 ot</em>.<strong>pages</strong>. Page names are mapped to classes within this package.</li><li>For mixins, place classes in <em>root</em>.<strong>mixins</strong>. Mixin types are mapped to classes within this package.</li><li>For other components, place classes in <em>root</em>.<strong>components</strong>. Component types are mapped to classes within this package.</li></ul><p>In addition, it is common for an application to have base classes, often <em>abstract</em> base classes, that should not be directly referenced. These should <em>not</em> go in the <strong>pages</strong>, <strong>components</strong> or <strong>mixins</strong> packages, because they then look like valid pages, components or mixins. Instead, use the <em>root</em>.<strong>base</strong> package to store such base classes.</p><div class="confluence-information-macro confluence-information-macro-warning"><span class="aui-icon aui-icon-small aui-iconfont-error confluence-information-macro-icon"></span><div class="confl
 uence-information-macro-body"><p>Only component classes should go in any of these controlled packages; classes representing data, or interfaces, or anything that isn't precisely a component class, must go elsewhere. Any top-level class in any of the controlled packages will be transformed at runtime. The only exception is inner classes (anonymous or not), which are loaded by the same class loader as the component class loader, but not transformed as components.</p></div></div><h2 id="ComponentClasses-Sub-Folders/Sub-Packages">Sub-Folders / Sub-Packages</h2><p>Classes do not have to go directly inside the package (pages, components, mixins, etc.). It is valid to create a sub-package to store some of the classes. The sub-package name becomes part of the page name or component type. Thus you might define a page component <code>com.example.myapp.pages.admin.CreateUser</code> and the logical page name (which often shows up inside URLs) will be <strong>admin/CreateUser</strong>.</p><p>Tap
 estry performs some simple optimizations of the logical page name (or component type, or mixin type). It checks to see if the package name is either a prefix or a suffix of the unqualified class name (case insensitively, of course) and removes the prefix or suffix if so. The net result is that a class name such as <code>com.example.myapp.pages.user.EditUser</code> will have a page name of <code>user/Edit</code> (instead of user<code>/EditUser</code>). The goal here is to provide shorter, more natural URLs.</p><h2 id="ComponentClasses-IndexPages">Index Pages</h2><p>One special simplification exists for Index pages: if the logical page name is Index after removing the package name from the unqualified class name, it will map to the root of that folder. A class such as <code>com.example.myapp.pages.user.IndexUser</code> or <code>com.example.myapp.pages.user.UserIndex</code> will have a page name of <code>user/</code>.</p><p>In previous versions of Tapestry there was also the concept of
  a start page configured with the <code><a  href="configuration.html">tapestry.start-page-name</a></code> configuration symbol (defaults to "start"). If a page with a name as configured with that symbol exists at the root level, this page is used as the root URL. This has precedence over an existing Index page. If for example you have a page class <code>com.example.myapp.pages.Start</code> it will map to <code>/</code>.</p><div class="confluence-information-macro confluence-information-macro-warning"><span class="aui-icon aui-icon-small aui-iconfont-error confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>Use of start-pages is discouraged and support for it will eventually be removed. Use an Index page instead.</p></div></div><h2 id="ComponentClasses-Pagesvs.Components">Pages vs. Components</h2><p>The distinction between pages and component is very, very small. The primary difference is the package name: <em>root</em>.<strong>pages</strong>.<
 em>PageName</em> for pages, and <em>root</em>.<strong>components</strong>.<em>ComponentType</em> for components. Conceptually, page components are simply the <em>root component</em> of a page's component tree.</p><p><em>For Tapestry 4 users: there was a much greater distinction in Tapestry 4 between pages and components, which showed up as separate interfaces and a hierarchy of abstract implementations to extend your classes from.</em></p><h2 id="ComponentClasses-ClassTransformation">Class Transformation</h2><p>Tapestry uses your class as a starting point. It <em>transforms</em> your class at runtime. This is necessary for a number of reasons, including to address how Tapestry shares pages between requests.</p><p>For the most part, these transformations are both sensible and invisible. In a few limited cases, they comprise a marginally&#160;<a  class="external-link" href="http://www.joelonsoftware.com/printerFriendly/articles/LeakyAbstractions.html" rel="nofollow">leaky abstraction<
 /a>&#160;&#8211; for instance, the scope restrictions on instance variables described below &#8211; but the programming model in general supports a very high level of developer productivity.</p><p>Because transformation doesn't occur until <em>runtime</em>, the build stage of your application is not affected by the fact that you are creating a Tapestry application. Further, your classes are absolutely simple POJOs during unit testing.</p><h2 id="ComponentClasses-LiveClassReloading">Live Class Reloading</h2><p>Main Article: <a  href="class-reloading.html">Class Reloading</a></p><p>Component classes are monitored for changes by the framework. <a  href="class-reloading.html">Classes are reloaded when changed</a>. This allows you to build your application with a speed approaching that of a scripting environment, without sacrificing any of the power of the Java platform.</p><p>And it's fast! You won't even notice that this magic class reloading has occurred.</p><p>The net result: super p
 roductivity &#8212; change your class, see the change instantly. This is designed to be a blend of the best of scripting environments (such as Python or Ruby) with all the speed and power of Java backing it up.</p><p>However, class reloading <em>only</em> applies to component classes (pages, components and mixins) and, starting in 5.2, Tapestry IOC-based service implementations (with some restrictions). Other classes, such as service interfaces, entity/model classes, and other data objects, are loaded by the normal class loader and not subject to live class reloading.</p><h2 id="ComponentClasses-InstanceVariables">Instance Variables</h2><p>Tapestry components may have instance variables (unlike Tapestry 4, where you had to use <em>abstract properties</em>).</p><p>Since release 5.3.2, instance variables may be protected, or package private (that is, no access modifier). Under specific circumstances they may even be public (public fields must either be final, or have the @<a  class="e
 xternal-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/annotations/Retain.html">Retain</a>&#160;annotation).</p><p><span style="line-height: 1.4285715;">Be aware that you will need to either provide getter and setter methods to access your classes' instance variables, or else annotate the fields with</span><span style="line-height: 1.4285715;">&#160;@</span><a  class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/annotations/Property.html" style="line-height: 1.4285715;">Property</a>.</p><h2 id="ComponentClasses-TransientInstanceVariables">Transient Instance Variables</h2><p>Unless an instance variable is decorated with an annotation, it will be a <em>transient</em> instance variable. This means that its value resets to its default value at the end of reach request (when the <a  href="page-life-cycle.html">page is detached from the request</a>).</p><div class="confluence-information-macro confluence-information-macr
 o-note"><p class="title">About initialization</p><span class="aui-icon aui-icon-small aui-iconfont-warning confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>Never initialize an instance field to a <em>mutable</em> object at the point of declaration. If this is done, the instance created from that initializer becomes the default value for that field and is reused inside the component on every request. This could cause state to inadvertently be shared between different sessions in an application.</p></div></div>
 
 <div class="confluence-information-macro confluence-information-macro-warning"><p class="title">Deprecated since 5.2</p><span class="aui-icon aui-icon-small aui-iconfont-error confluence-information-macro-icon"></span><div class="confluence-information-macro-body">
 </div></div>
-<div style="border-right: 20px solid #ffcccc;border-left: 20px solid #ffcccc;"><p>For Tapestry 5.1 and earlier, in the rare event that you have a variable that can keep its value between requests and you would like to defeat that reset logic, then you can add a @<a  class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/annotations/Retain.html">Retain</a> annotation to the field. You should take care that no client-specific data is stored into such a field, since on a later request the same page <em>instance</em> may be used for a different user. Likewise, on a later request for the <em>same</em> client, a <em>different</em> page instance may be used.</p></div><p>Use <a  href="persistent-page-data.html">persistent fields</a> to hold client-specific information from one request to the next.</p><p>Further, final fields are (in fact) final, and will not be reset between requests.</p><h2 id="ComponentClasses-Constructors">Constructors</h2><p>Tapestry
  will instantiate your class using the default, no arguments constructor. Other constructors will be ignored.</p><h2 id="ComponentClasses-Injection">Injection</h2><p>Main Article: <a  href="injection.html">Injection</a></p><p>Injection of dependencies occurs at the field level, via additional annotations. At runtime, fields that contain injections become read-only.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<div class="error"><span class="error">Unknown macro: {div}</span> 
+<p>For Tapestry 5.1 and earlier, in the rare event that you have a variable that can keep its value between requests and you would like to defeat that reset logic, then you can add a @<a  class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/annotations/Retain.html">Retain</a> annotation to the field. You should take care that no client-specific data is stored into such a field, since on a later request the same page <em>instance</em> may be used for a different user. Likewise, on a later request for the <em>same</em> client, a <em>different</em> page instance may be used.</p>
+</div><p>Use <a  href="persistent-page-data.html">persistent fields</a> to hold client-specific information from one request to the next.</p><p>Further, final fields are (in fact) final, and will not be reset between requests.</p><h2 id="ComponentClasses-Constructors">Constructors</h2><p>Tapestry will instantiate your class using the default, no arguments constructor. Other constructors will be ignored.</p><h2 id="ComponentClasses-Injection">Injection</h2><p>Main Article: <a  href="injection.html">Injection</a></p><p>Injection of dependencies occurs at the field level, via additional annotations. At runtime, fields that contain injections become read-only.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
 <pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;">@Inject // inject a resource
 private ComponentResources componentResources;