Modified: 
websites/production/tapestry/content/using-tapestry-with-hibernate.html
==============================================================================
--- websites/production/tapestry/content/using-tapestry-with-hibernate.html 
(original)
+++ websites/production/tapestry/content/using-tapestry-with-hibernate.html Sun 
Dec 14 13:20:36 2014
@@ -186,7 +186,7 @@ public class CreateAddress
     }
 }
 ]]></script>
-</div></div><p>The <a shape="rect" class="external-link" 
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/ioc/annotations/Inject.html";>Inject</a>
 annotation tells Tapestry to inject a service into the annotated field; 
Tapestry includes a sophisticated Inversion of Control container (similar in 
many ways to Spring) that is very good at locating available services by type, 
rather than by a string id. In any case, the Hibernate Session object is 
exposed as a Tapestry IoC service, ready to be injected (this is one of the 
things provided by the tapestry-hibernate module).</p><p>Tapestry automatically 
starts a transaction as necessary; however that transaction will be 
<em>aborted</em> at the end of the request by default. If we make changes to 
persistent objects, such as adding a new Address object, then it is necessary 
to commit the transaction.</p><p>The <a shape="rect" class="external-link" 
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/hiber
 nate/annotations/CommitAfter.html">CommitAfter</a> annotation can be applied 
to any component method; if the method completes normally, the transaction will 
be committed (and a new transaction started to replace the committed 
transaction).</p><p>After persisting the new address, we return to the main 
Index page of the application.</p><p><em>Note: In real applications, it is rare 
to have pages and components directly use the Hibernate Session. It is 
generally a better approach to define your own Data Access Object layer to 
perform common update operations and queries.</em></p><h2 
id="UsingTapestryWithHibernate-ShowingAddresses">Showing Addresses</h2><p>As a 
little preview of what's next, let's display all the Addresses entered by the 
user on the Index page of the application. After you enter a few names, it will 
look something like:</p><p><img class="confluence-embedded-image 
confluence-content-image-border" 
src="https://cwiki.apache.org/confluence/download/attachments/23340507/index
 -grid-v1.png?version=4&amp;modificationDate=1418482289909&amp;api=v2" 
data-image-src="/confluence/download/attachments/23340507/index-grid-v1.png?version=4&amp;modificationDate=1418482289909&amp;api=v2"></p><h2
 id="UsingTapestryWithHibernate-AddingtheGridtotheIndexpage">Adding the Grid to 
the Index page</h2><p>So, how is this implemented? Primarily, its accomplished 
by the <a shape="rect" class="external-link" 
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/components/Grid.html";>Grid</a>
 component.</p><p>The Grid component is based on the same concepts as the 
BeanEditForm component; it can pull apart a bean into columns. The columns are 
sortable, and when there are more entries than will fit on a single page, page 
navigation is automatically added.</p><p>A minimal Grid is very easy to add to 
the template. Just add this near the bottom of Index.tml:</p><div class="code 
panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" 
style="b
 order-bottom-width: 1px;"><b>src/main/webapp/Index.tml (partial)</b></div><div 
class="codeContent panelContent pdl">
+</div></div><p>The <a shape="rect" class="external-link" 
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/ioc/annotations/Inject.html";>Inject</a>
 annotation tells Tapestry to inject a service into the annotated field; 
Tapestry includes a sophisticated Inversion of Control container (similar in 
many ways to Spring) that is very good at locating available services by type, 
rather than by a string id. In any case, the Hibernate Session object is 
exposed as a Tapestry IoC service, ready to be injected (this is one of the 
things provided by the tapestry-hibernate module).</p><p>Tapestry automatically 
starts a transaction as necessary; however that transaction will be 
<em>aborted</em> at the end of the request by default. If we make changes to 
persistent objects, such as adding a new Address object, then it is necessary 
to commit the transaction.</p><p>The <a shape="rect" class="external-link" 
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/hiber
 nate/annotations/CommitAfter.html">CommitAfter</a> annotation can be applied 
to any component method; if the method completes normally, the transaction will 
be committed (and a new transaction started to replace the committed 
transaction).</p><p>After persisting the new address, we return to the main 
Index page of the application.</p><p><em>Note: In real applications, it is rare 
to have pages and components directly use the Hibernate Session. It is 
generally a better approach to define your own Data Access Object layer to 
perform common update operations and queries.</em></p><h2 
id="UsingTapestryWithHibernate-ShowingAddresses">Showing Addresses</h2><p>As a 
little preview of what's next, let's display all the Addresses entered by the 
user on the Index page of the application. After you enter a few names, it will 
look something like:</p><p><img class="confluence-embedded-image 
confluence-content-image-border" 
src="using-tapestry-with-hibernate.data/index-grid-v1.png" data-image-src="/
 
confluence/download/attachments/23340507/index-grid-v1.png?version=4&amp;modificationDate=1418482289000&amp;api=v2"></p><h2
 id="UsingTapestryWithHibernate-AddingtheGridtotheIndexpage">Adding the Grid to 
the Index page</h2><p>So, how is this implemented? Primarily, its accomplished 
by the <a shape="rect" class="external-link" 
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/components/Grid.html";>Grid</a>
 component.</p><p>The Grid component is based on the same concepts as the 
BeanEditForm component; it can pull apart a bean into columns. The columns are 
sortable, and when there are more entries than will fit on a single page, page 
navigation is automatically added.</p><p>A minimal Grid is very easy to add to 
the template. Just add this near the bottom of Index.tml:</p><div class="code 
panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" 
style="border-bottom-width: 1px;"><b>src/main/webapp/Index.tml 
(partial)</b></div><div class="c
 odeContent panelContent pdl">
 <script class="theme: Default; brush: xml; gutter: false" 
type="syntaxhighlighter"><![CDATA[  &lt;t:grid source=&quot;addresses&quot;
          
include=&quot;honorific,firstName,lastName,street1,city,state,zip,phone&quot;/&gt;
 ]]></script>

Modified: websites/production/tapestry/content/version-numbers.html
==============================================================================
--- websites/production/tapestry/content/version-numbers.html (original)
+++ websites/production/tapestry/content/version-numbers.html Sun Dec 14 
13:20:36 2014
@@ -38,19 +38,13 @@
 </div></div>
 
 <div id="top">
-<div id="smallbanner"><div class="searchbox" style="float:right;margin: .3em 
1em .1em 1em">
-<p>
-<span style="color: #999; font-size: 90%">Tapestry docs, issues, wikis &amp; 
blogs:</span>
-</p><form enctype="application/x-www-form-urlencoded" method="get" 
action="http://tapestry.apache.org/search.html";>
+<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"><a shape="rect" href="index.html"><img 
class="confluence-embedded-image" 
src="https://cwiki.apache.org/confluence/download/attachments/21791252/tapestry_s.png?version=3&amp;modificationDate=1293093635000&amp;api=v2";
 
data-image-src="/confluence/download/attachments/21791252/tapestry_s.png?version=3&amp;modificationDate=1293093635000&amp;api=v2"></a></div>
-<div class="title" style="float:left; margin: 0 0 0 3em">
-<h1 id="SmallBanner-PageTitle">Version Numbers</h1></div></div>
+</div><div class="emblem" style="float:left"><p><a shape="rect" 
href="index.html"><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";></a></p></div><div
 class="title" style="float:left; margin: 0 0 0 3em"><h1 
id="SmallBanner-PageTitle">Version Numbers</h1></div></div>
 <div class="clearer"></div>
 </div>
 

Modified: websites/production/tapestry/content/whatistapestry.html
==============================================================================
--- websites/production/tapestry/content/whatistapestry.html (original)
+++ websites/production/tapestry/content/whatistapestry.html Sun Dec 14 
13:20:36 2014
@@ -38,19 +38,13 @@
 </div></div>
 
 <div id="top">
-<div id="smallbanner"><div class="searchbox" style="float:right;margin: .3em 
1em .1em 1em">
-<p>
-<span style="color: #999; font-size: 90%">Tapestry docs, issues, wikis &amp; 
blogs:</span>
-</p><form enctype="application/x-www-form-urlencoded" method="get" 
action="http://tapestry.apache.org/search.html";>
+<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"><a shape="rect" href="index.html"><img 
class="confluence-embedded-image" 
src="https://cwiki.apache.org/confluence/download/attachments/21791252/tapestry_s.png?version=3&amp;modificationDate=1293093635000&amp;api=v2";
 
data-image-src="/confluence/download/attachments/21791252/tapestry_s.png?version=3&amp;modificationDate=1293093635000&amp;api=v2"></a></div>
-<div class="title" style="float:left; margin: 0 0 0 3em">
-<h1 id="SmallBanner-PageTitle">whatIsTapestry</h1></div></div>
+</div><div class="emblem" style="float:left"><p><a shape="rect" 
href="index.html"><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";></a></p></div><div
 class="title" style="float:left; margin: 0 0 0 3em"><h1 
id="SmallBanner-PageTitle">whatIsTapestry</h1></div></div>
 <div class="clearer"></div>
 </div>
 


Reply via email to