Author: mck
Date: Tue Jan  1 23:21:49 2013
New Revision: 1427588

URL: http://svn.apache.org/viewvc?rev=1427588&view=rev
Log:
push to staging the doc improvements from Michael Isvy
 http://svn.apache.org/viewvc?view=revision&revision=1427575

Modified:
    tiles/site/staging/framework/tutorial/advanced/wildcard.html

Modified: tiles/site/staging/framework/tutorial/advanced/wildcard.html
URL: 
http://svn.apache.org/viewvc/tiles/site/staging/framework/tutorial/advanced/wildcard.html?rev=1427588&r1=1427587&r2=1427588&view=diff
==============================================================================
--- tiles/site/staging/framework/tutorial/advanced/wildcard.html (original)
+++ tiles/site/staging/framework/tutorial/advanced/wildcard.html Tue Jan  1 
23:21:49 2013
@@ -1,5 +1,5 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
-<!-- Generated by Apache Maven Doxia at Jul 11, 2012 -->
+<!-- Generated by Apache Maven Doxia at Jan 2, 2013 -->
 <html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en">
   <head>
     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
@@ -10,7 +10,7 @@
       @import url("../../css/site.css");
     </style>
     <link rel="stylesheet" href="../../css/print.css" type="text/css" 
media="print" />
-    <meta name="Date-Revision-yyyymmdd" content="20120711" />
+    <meta name="Date-Revision-yyyymmdd" content="20130102" />
     <meta http-equiv="Content-Language" content="en" />
         
         </head>
@@ -30,8 +30,8 @@
             
         
                 <div class="xleft">
-        <span id="publishDate">Last Published: 2012-07-11</span>
-                  &nbsp;| <span id="projectVersion">Version: 3.0.1</span>
+        <span id="publishDate">Last Published: 2013-01-02</span>
+                  &nbsp;| <span id="projectVersion">Version: 
3.0.2-SNAPSHOT</span>
                       </div>
             <div class="xright">                    <a 
href="http://www.apache.org"; class="externalLink" title="Apache">Apache</a>
             |
@@ -225,23 +225,55 @@
     </div>
     <div id="bodyColumn">
       <div id="contentBox">
-        <!-- $Id: wildcard.apt 1310865 2012-04-07 21:01:22Z nlebas $ --><!--  
--><!-- Licensed to the Apache Software Foundation (ASF) under one --><!-- or 
more contributor license agreements.  See the NOTICE file --><!-- distributed 
with this work for additional information --><!-- regarding copyright 
ownership.  The ASF licenses this file --><!-- to you under the Apache License, 
Version 2.0 (the --><!-- "License"); you may not use this file except in 
compliance --><!-- with the License.  You may obtain a copy of the License at 
--><!--  --><!-- http://www.apache.org/licenses/LICENSE-2.0 --><!--  --><!-- 
Unless required by applicable law or agreed to in writing, --><!-- software 
distributed under the License is distributed on an --><!-- "AS IS" BASIS, 
WITHOUT WARRANTIES OR CONDITIONS OF ANY --><!-- KIND, either express or 
implied.  See the License for the --><!-- specific language governing 
permissions and limitations --><!-- under the License. --><!--  --><div 
class="sectio
 n"><h2>Wildcard support<a name="Wildcard_support"></a></h2><p>By default, 
Tiles supports wildcards in definition names. Wilcards help a lot in writing 
less code to declare your definitions.</p><p>There are two 
styles:</p><ul><li>the wildcard-based style (available by 
default):<div><pre>&lt;definition name=&quot;test.definition*.message*&quot; 
template=&quot;/layout{1}.jsp&quot;&gt;
+        <!-- $Id: wildcard.apt 1427575 2013-01-01 22:22:03Z mck $ --><!--  
--><!-- Licensed to the Apache Software Foundation (ASF) under one --><!-- or 
more contributor license agreements.  See the NOTICE file --><!-- distributed 
with this work for additional information --><!-- regarding copyright 
ownership.  The ASF licenses this file --><!-- to you under the Apache License, 
Version 2.0 (the --><!-- "License"); you may not use this file except in 
compliance --><!-- with the License.  You may obtain a copy of the License at 
--><!--  --><!-- http://www.apache.org/licenses/LICENSE-2.0 --><!--  --><!-- 
Unless required by applicable law or agreed to in writing, --><!-- software 
distributed under the License is distributed on an --><!-- "AS IS" BASIS, 
WITHOUT WARRANTIES OR CONDITIONS OF ANY --><!-- KIND, either express or 
implied.  See the License for the --><!-- specific language governing 
permissions and limitations --><!-- under the License. --><!--  --><div 
class="section">
 <h2>Wildcard support<a name="Wildcard_support"></a></h2><p>By default, Tiles 
supports wildcards in definition names. Wilcards help a lot in writing less 
code to declare your definitions.</p><div class="section"><h3>Default 
configuration<a name="Default_configuration"></a></h3><p>Note: default 
configuration only works if you do not use 
<tt>CompleteAutoloadTilesContainerFactory</tt>. If you are using this setting, 
you can move to the next section.</p><p>Let us start with a simple example. 
When not using wildcards, you might end up with such tiles 
definitions:</p><div><pre>&lt;definition name=&quot;bank/user&quot; 
template=&quot;/layout.jsp&quot;&gt;
+    &lt;put-attribute name=&quot;header&quot; 
value=&quot;/header.jsp&quot;/&gt;
+    &lt;put-attribute name=&quot;body&quot;   value=&quot;/user.jsp&quot;/&gt;
+&lt;/definition&gt;
+
+&lt;definition name=&quot;bank/account&quot; 
template=&quot;/layout.jsp&quot;&gt;
+    &lt;put-attribute name=&quot;header&quot; 
value=&quot;/header.jsp&quot;/&gt;
+    &lt;put-attribute name=&quot;body&quot;   
value=&quot;/account.jsp&quot;/&gt;
+&lt;/definition&gt;
+
+&lt;definition name=&quot;bank/customer&quot; 
template=&quot;/layout.jsp&quot;&gt;
+    &lt;put-attribute name=&quot;header&quot; 
value=&quot;/header.jsp&quot;/&gt;
+    &lt;put-attribute name=&quot;body&quot;   
value=&quot;/customer.jsp&quot;/&gt;
+&lt;/definition&gt;</pre></div><p>The above definitions are pretty verbose as 
you need to create one definition per JSP that you're adding to your 
application. You could use definition inheritance to reduce the number of lines 
but you would still need one definition per JSP.</p><div 
class="section"><h4>Single star '*'<a name="Single_star_"></a></h4><p>Let's see 
how to improve that using wildcards. You would then 
have:</p><div><pre>&lt;definition name=&quot;bank/*&quot; 
template=&quot;/layout.jsp&quot;&gt;
+    &lt;put-attribute name=&quot;header&quot; 
value=&quot;/header.jsp&quot;/&gt;
+    &lt;put-attribute name=&quot;body&quot;   value=&quot;/{1}.jsp&quot;/&gt;
+&lt;/definition&gt;
+</pre></div><p>Calling a view named &quot;bank/user&quot; matches the above 
definition name. Inside the &quot;body&quot; attributes, {1} refers to the 
star's value which is &quot;user&quot; in that case.</p></div><div 
class="section"><h4>Multiple stars such as in '*/*'<a 
name="Multiple_stars_such_as_in_"></a></h4><p>Let's now consider another case. 
As you can see, the sample below uses 2 stars '*'.</p><div><pre>&lt;definition 
name=&quot;bank/*/*&quot; template=&quot;/layout.jsp&quot;&gt;
+    &lt;put-attribute name=&quot;header&quot; 
value=&quot;/header.jsp&quot;/&gt;
+    &lt;put-attribute name=&quot;body&quot;   
value=&quot;/{1}-{2}.jsp&quot;/&gt;
+&lt;/definition&gt;
+</pre></div><p>Calling a view named &quot;/bank/customer/account&quot; matches 
the above definition name. Inside the 'body' attribute, {1} refers to the first 
star and {2} refers to the second one. The &quot;body&quot; JSP name will be 
&quot;customer-account.jsp&quot;.</p><p>Here is another example which shows 
that you can use package-style definition names:</p><div><pre>&lt;definition 
name=&quot;test.definition*.message*&quot; 
template=&quot;/layout{1}.jsp&quot;&gt;
     &lt;put-attribute name=&quot;title&quot;  value=&quot;This definition has 
a message: {2}.&quot;/&gt;
     &lt;put-attribute name=&quot;header&quot; 
value=&quot;/header.jsp&quot;/&gt;
     &lt;put-attribute name=&quot;body&quot;   value=&quot;/body.jsp&quot;/&gt;
-&lt;/definition&gt;</pre></div></li></ul><div class="section"><h3><a 
name="Using_different_pattern_matching_languages">Using different pattern 
matching languages</a></h3><p>If you're using the 
<tt>CompleteAutoloadTilesContainerFactory</tt>, you must use a predix to 
specify the pattern matching language you're using: either WILDCARD or 
REGEXP:</p><div><pre>&lt;definition 
name=&quot;WILDCARD:test.definition*.message*&quot; 
template=&quot;/layout{1}.jsp&quot;&gt;
+&lt;/definition&gt;</pre></div></div></div><div class="section"><h3>Using 
prefixes<a name="Using_prefixes"></a></h3><div class="section"><h4>Enabling 
CompleteAutoloadTilesContainerFactory<a 
name="Enabling_CompleteAutoloadTilesContainerFactory"></a></h4><p>As a 
prerequisite for using prefixes, you need to have 
CompleteAutoloadTilesContainerFactory enabled.</p><p>If you haven't enabled it 
yet, here is a quick checklist for you to use.</p><p>The library tiles-extras 
is required. If you're using Maven, you need to add this dependency to you POM 
file:</p><div><pre>&lt;dependency&gt;
+        &lt;groupId&gt;org.apache.tiles&lt;/groupId&gt;
+        &lt;artifactId&gt;tiles-extras&lt;/artifactId&gt;
+        &lt;version&gt;2.2.2&lt;/version&gt;
+&lt;/dependency&gt;</pre></div><p>If you are using Spring, you should add the 
'completeAutoload' attribute to your TilesConfigurer 
bean.</p><div><pre>&lt;bean id=&quot;tilesConfigurer&quot; 
class=&quot;org.springframework.web.servlet.view.tiles2.TilesConfigurer&quot;&gt;
+        &lt;property name=&quot;completeAutoload&quot; 
value=&quot;true&quot;/&gt;
+&lt;/bean&gt;</pre></div></div><div class="section"><h4>Using prefixes for 
wildcards and Regular Expressions<a 
name="Using_prefixes_for_wildcards_and_Regular_Expressions"></a></h4><p>When 
using completeAutoload, you can use wildcard expressions and/or regexp. Each of 
them should be enabled using the dedicated prefix as follows.</p><div 
class="section"><h5>WILDCARD<a 
name="WILDCARD"></a></h5><div><pre>&lt;definition 
name=&quot;WILDCARD:test.definition*.message*&quot; 
template=&quot;/layout{1}.jsp&quot;&gt;
     &lt;put-attribute name=&quot;title&quot;  value=&quot;This definition has 
a message: {2}.&quot;/&gt;
     &lt;put-attribute name=&quot;header&quot; 
value=&quot;/header.jsp&quot;/&gt;
     &lt;put-attribute name=&quot;body&quot;   value=&quot;/body.jsp&quot;/&gt;
-&lt;/definition&gt;</pre></div><p>And, if you want to use Regular 
Expressions:</p><div><pre>&lt;definition 
name=&quot;REGEXP:test\.definition(.*)\.message(.*)&quot; 
template=&quot;/layout{1}.jsp&quot;&gt;
+&lt;/definition&gt;
+
+&lt;definition name=&quot;WILDCARD:bank/*&quot; 
template=&quot;/layout.jsp&quot;&gt;
+    &lt;put-attribute name=&quot;header&quot; 
value=&quot;/header.jsp&quot;/&gt;
+    &lt;put-attribute name=&quot;body&quot;   value=&quot;/{1}.jsp&quot;/&gt;
+&lt;/definition&gt;</pre></div><p>And, if you want to use Regular 
Expressions:</p></div><div class="section"><h5>REGEXP<a 
name="REGEXP"></a></h5><div><pre>&lt;definition 
name=&quot;REGEXP:test\.definition(.*)\.message(.*)&quot; 
template=&quot;/layout{1}.jsp&quot;&gt;
     &lt;put-attribute name=&quot;title&quot;  value=&quot;This definition has 
a message: {2}.&quot;/&gt;
     &lt;put-attribute name=&quot;header&quot; 
value=&quot;/header.jsp&quot;/&gt;
     &lt;put-attribute name=&quot;body&quot;   value=&quot;/body.jsp&quot;/&gt;
-&lt;/definition&gt;</pre></div><p>In both cases, if you insert a definition 
that matches the definition, for 
example:</p><div><pre>&lt;tiles:insertDefinition 
name=&quot;test.definitionOne.messageThisIsAMessage&quot; 
/&gt;</pre></div><p>The definition is automatically mapped, replacing 
placeholders, marked by curly brackets, with the value of matched definitions. 
In this case:</p><div><pre>&lt;definition 
name=&quot;test.definitionOne.messageThisIsAMessage&quot; 
template=&quot;/layoutOne.jsp&quot;&gt;
+&lt;/definition&gt;</pre></div></div><div 
class="section"><h5>tiles:insertDefinition<a 
name="tiles:insertDefinition"></a></h5><p>In both cases, if you insert a 
definition that matches the definition, for 
example:</p><div><pre>&lt;tiles:insertDefinition 
name=&quot;test.definitionOne.messageThisIsAMessage&quot; 
/&gt;</pre></div><p>The definition is automatically mapped, replacing 
placeholders, marked by curly brackets, with the value of matched definitions. 
In this case:</p><div><pre>&lt;definition 
name=&quot;test.definitionOne.messageThisIsAMessage&quot; 
template=&quot;/layoutOne.jsp&quot;&gt;
     &lt;put-attribute name=&quot;title&quot;  value=&quot;This definition has 
a message: ThisIsAMessage.&quot;/&gt;
     &lt;put-attribute name=&quot;header&quot; 
value=&quot;/header.jsp&quot;/&gt;
     &lt;put-attribute name=&quot;body&quot;   value=&quot;/body.jsp&quot;/&gt;
-&lt;/definition&gt;</pre></div></div></div>
+&lt;/definition&gt;</pre></div></div></div></div></div>
       </div>
     </div>
     <div class="clear">
@@ -249,7 +281,7 @@
     </div>
     <div id="footer">
       <div class="xright">
-              Copyright &#169;                    2001-2012
+              Copyright &#169;                    2001-2013
                         <a href="http://www.apache.org";>Apache Software 
Foundation</a>.
             All Rights Reserved.      
         


Reply via email to