You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tiles.apache.org by mc...@apache.org on 2013/01/02 09:51:01 UTC

svn commit: r1427707 - /tiles/site/staging/framework/tutorial/advanced/wildcard.html

Author: mck
Date: Wed Jan  2 08:51:01 2013
New Revision: 1427707

URL: http://svn.apache.org/viewvc?rev=1427707&view=rev
Log:
push to staging lastest wildcard doc improvements from Michael Isvy

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=1427707&r1=1427706&r2=1427707&view=diff
==============================================================================
--- tiles/site/staging/framework/tutorial/advanced/wildcard.html (original)
+++ tiles/site/staging/framework/tutorial/advanced/wildcard.html Wed Jan  2 08:51:01 2013
@@ -225,7 +225,7 @@
     </div>
     <div id="bodyColumn">
       <div id="contentBox">
-        <!-- $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;
+        <!-- $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><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;
@@ -253,10 +253,14 @@
 &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;version&gt;3.0.1&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.tiles3.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;/bean&gt;</pre></div></div><div class="section"><h4>Using prefixes<a name="Using_prefixes"></a></h4><p>Here is an example of prefix using Regular Expressions:</p><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>The below sample uses WILDCARD (this prefix is not needed when using wildcards solely, as shown in the 'Default Configuration' section).</p><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;
@@ -265,15 +269,11 @@
 &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></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;/definition&gt;</pre></div></div></div><div class="section"><h3>tiles:insertDefinition<a name="tiles:insertDefinition"></a></h3><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></div></div>
+&lt;/definition&gt;</pre></div></div></div>
       </div>
     </div>
     <div class="clear">