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><definition name="bank/user" template="/layout.jsp">
+ <!-- $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><definition name="bank/user" template="/layout.jsp">
<put-attribute name="header" value="/header.jsp"/>
<put-attribute name="body" value="/user.jsp"/>
</definition>
@@ -253,10 +253,14 @@
</definition></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><dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-extras</artifactId>
- <version>2.2.2</version>
-</dependency></pre></div><p>If you are using Spring, you should add the 'completeAutoload' attribute to your TilesConfigurer bean.</p><div><pre><bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles2.TilesConfigurer">
+ <version>3.0.1</version>
+</dependency></pre></div><p>If you are using Spring, you should add the 'completeAutoload' attribute to your TilesConfigurer bean.</p><div><pre><bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles3.TilesConfigurer">
<property name="completeAutoload" value="true"/>
-</bean></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><definition name="WILDCARD:test.definition*.message*" template="/layout{1}.jsp">
+</bean></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><definition name="REGEXP:test\.definition(.*)\.message(.*)" template="/layout{1}.jsp">
+ <put-attribute name="title" value="This definition has a message: {2}."/>
+ <put-attribute name="header" value="/header.jsp"/>
+ <put-attribute name="body" value="/body.jsp"/>
+</definition></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><definition name="WILDCARD:test.definition*.message*" template="/layout{1}.jsp">
<put-attribute name="title" value="This definition has a message: {2}."/>
<put-attribute name="header" value="/header.jsp"/>
<put-attribute name="body" value="/body.jsp"/>
@@ -265,15 +269,11 @@
<definition name="WILDCARD:bank/*" template="/layout.jsp">
<put-attribute name="header" value="/header.jsp"/>
<put-attribute name="body" value="/{1}.jsp"/>
-</definition></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><definition name="REGEXP:test\.definition(.*)\.message(.*)" template="/layout{1}.jsp">
- <put-attribute name="title" value="This definition has a message: {2}."/>
- <put-attribute name="header" value="/header.jsp"/>
- <put-attribute name="body" value="/body.jsp"/>
-</definition></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><tiles:insertDefinition name="test.definitionOne.messageThisIsAMessage" /></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><definition name="test.definitionOne.messageThisIsAMessage" template="/layoutOne.jsp">
+</definition></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><tiles:insertDefinition name="test.definitionOne.messageThisIsAMessage" /></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><definition name="test.definitionOne.messageThisIsAMessage" template="/layoutOne.jsp">
<put-attribute name="title" value="This definition has a message: ThisIsAMessage."/>
<put-attribute name="header" value="/header.jsp"/>
<put-attribute name="body" value="/body.jsp"/>
-</definition></pre></div></div></div></div></div>
+</definition></pre></div></div></div>
</div>
</div>
<div class="clear">