Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Shale Wiki" for change 
notification.

The following page has been changed by Hermod Opstvedt:
http://wiki.apache.org/shale/ShaleAndClayTutorial

------------------------------------------------------------------------------
  
  These declarations (context-param) are used by Clay and the JavaServer Faces 
(JSF) implementation at startup.
  
- * javax.faces.DEFAULT_SUFFIX – Tells which page suffixes should be handled 
by JSF
+ * javax.faces.DEFAULT_SUFFIX – Tells which page suffixes should be handled 
by JSF[[BR]]
- * javax.faces.STATE_SAVING_METHOD – How should session state be persisted 
(Client-side or Server-side)
+ * javax.faces.STATE_SAVING_METHOD – How should session state be persisted 
(Client-side or Server-side)[[BR]]
- * org.apache.shale.clay.COMMON_CONFIG_FILES – What are the name(s )of the 
Clay configuration file(s),  providing absolute path within the web-context
+ * org.apache.shale.clay.COMMON_CONFIG_FILES – What are the name(s )of the 
Clay configuration file(s),  providing absolute path within the 
web-context[[BR]]
- * org.apache.shale.clay.FULLXML_CONFIG_FILES – What are the name(s) of the 
Clay configuration file(s) that tells Clay about our page definitions.
+ * org.apache.shale.clay.FULLXML_CONFIG_FILES – What are the name(s) of the 
Clay configuration file(s) that tells Clay about our page definitions.[[BR]]
- * org.apache.shale.clay.XML_TEMPLATE_SUFFIX – Which page suffixes should be 
handled by Clay.
+ * org.apache.shale.clay.XML_TEMPLATE_SUFFIX – Which page suffixes should be 
handled by Clay.[[BR]]
  
  The are the Filter defintions. A filter is a Javaclass that will be called by 
the webcontainer on every request that comes into it (Actually only requests 
that match a certain predefined pattern – See filter-mapping below)
  
@@ -183, +183 @@

  
  The next file we look at is the faces-config.xml file. This file governs the 
setup of JSF. It is normally divided into three sections
  
- * General information - application 
+ * General information - application [[BR]]
- * Navigation rules - navigation-rule
+ * Navigation rules - navigation-rule[[BR]]
- * Managed beans - managed-bean
+ * Managed beans - managed-bean[[BR]]
  
  First in out file we define which languages this application supports; 
Norwegian(no) and English(en), and that the default is English.
  
@@ -201, +201 @@

  
  If we take a closer look at it we see that it is devided into sections. These 
sections are the parts of the page that naturally lend tem selves to a 
functionalitygroup and as such are candidates for reuse. This is known as 
templating. The page is formatted as a “liquid design” layout. If you want 
to read up on this, a good place to start is 
[http://www.mardiros.net/liquid-css-layouts.html/ Carmen Mardios]
  
+ The section that the page is divided into are:
+ 
+    * Pagetitle[[BR]]
+    * Leftmenu[[BR]]
+    * Content[[BR]]
+    * Footer[[BR]]
+ 
+ <body>[[BR]]
+       <div id="head"><span jsfid="clay" clayjsfid="@headerContent"[[BR]]
+               allowbody="false">Header Content</span></div>[[BR]]
+       <div id='logo'>&nbsp;</div>[[BR]]
+       <div id="left">&nbsp;</div>[[BR]]
+       <div id="menu"><span jsfid="clay" clayjsfid="@leftContent"[[BR]]
+               allowbody="false">Left Content</span></div>[[BR]]
+       <div id="pad1">&nbsp;</div>[[BR]]
+       <div id='content'><span jsfid="clay" clayjsfid="@bodyContent"[[BR]]
+               allowbody="false">Body Content</span></div>[[BR]]
+       <div id="pad1">&nbsp;</div>[[BR]]
+       <div id="footer"><span jsfid="clay" clayjsfid="@footerContent"[[BR]]
+               allowbody="false">Footer Content</span></div>[[BR]]
+ </body>[[BR]]
+ 
+ These sections are identifiable with the help of the attribute 
”clayjsfid” on the <SPAN> tags. Here we see that we have: @headerContent, 
@leftContent. @bodyContent and @footerContent. These are what we refer to as 
symbols in Clay. This means that Clay processes the page looking for symbols 
and replaces them with their counterpart efinition in the configuration 
file(s). Lets look at how this template is defined as a Clay component in the 
clay-config.xml file:
+ 
+       <component jsfid="baseLayout" extends="clay" id="base">[[BR]]
+               <attributes>[[BR]]
+                       <set name="clayJsfid" value="/templates/standard.html" 
/>[[BR]]
+               </attributes>[[BR]]
+               <symbols>[[BR]]
+                       <set name="title" value="Hello World" />[[BR]]
+                       <set name="leftContent" 
value="/pages/defaultLeftNav.html" />[[BR]]
+                       <set name="headerContent" 
value="/pages/defaultHeader.html" />[[BR]]
+                       <set name="bodyContent" value="/pages/defaultBody.html" 
/>[[BR]]
+                       <set name="footerContent" 
value="/pages/defaultFooter.html" />[[BR]]
+               </symbols>[[BR]]
+       </component>[[BR]]
+ 

Reply via email to