Author: apetrelli
Date: Fri Sep 19 12:30:45 2008
New Revision: 697197
URL: http://svn.apache.org/viewvc?rev=697197&view=rev
Log:
TILES-294
Added documentation for EL support.
Added:
tiles/framework/trunk/src/site/apt/tutorial/advanced/el-support.apt
Modified:
tiles/framework/trunk/src/site/apt/config-reference.apt
tiles/framework/trunk/src/site/apt/tutorial/advanced/index.apt
tiles/framework/trunk/src/site/apt/tutorial/index.apt
tiles/framework/trunk/src/site/site.xml
Modified: tiles/framework/trunk/src/site/apt/config-reference.apt
URL:
http://svn.apache.org/viewvc/tiles/framework/trunk/src/site/apt/config-reference.apt?rev=697197&r1=697196&r2=697197&view=diff
==============================================================================
--- tiles/framework/trunk/src/site/apt/config-reference.apt (original)
+++ tiles/framework/trunk/src/site/apt/config-reference.apt Fri Sep 19 12:30:45
2008
@@ -42,6 +42,8 @@
*---------------------------------------------+--------------------------------------+
|
{{{config-reference.html#org.apache.tiles.definition.DefinitionsFactory}<<<org.apache.tiles.definition.DefinitionsFactory>>>}}
| Definitions factory class name |
*---------------------------------------------+--------------------------------------+
+|
{{{config-reference.html#org.apache.tiles.evaluator.AttributeEvaluator}<<<org.apache.tiles.evaluator.AttributeEvaluator>>>}}
| Attribute evaluator class name |
+*---------------------------------------------+--------------------------------------+
|
{{{config-reference.html#org.apache.tiles.preparer.PreparerFactory}<<<org.apache.tiles.preparer.PreparerFactory>>>}}
| View preparer factory class name |
*---------------------------------------------+--------------------------------------+
@@ -135,6 +137,18 @@
* <<Usage>>: when specified, it must contain the name of a class that
implements the <<<DefinitionsFactory>>> interface.
+** {<<<org.apache.tiles.evaluator.AttributeEvaluator>>>}
+
+ Specifies the attribute evaluator class name to use.
+
+ * <<Specified in>>:
+
{{{framework/apidocs/org/apache/tiles/factory/TilesContainerFactory.html#ATTRIBUTE_EVALUATOR_INIT_PARAM}<<<org.apache.tiles.factory.TilesContainerFactory>>>}}.
+
+ * <<Default>>:
<<<org.apache.tiles.evaluator.impl.DirectAttributeEvaluator>>>.
+
+ * <<Usage>>: when specified, it must contain the name of a class that
+ implements the <<<AttributeEvaluator>>> interface.
+
** {<<<org.apache.tiles.preparer.PreparerFactory>>>}
Specifies the view preparer factory class name to use.
Added: tiles/framework/trunk/src/site/apt/tutorial/advanced/el-support.apt
URL:
http://svn.apache.org/viewvc/tiles/framework/trunk/src/site/apt/tutorial/advanced/el-support.apt?rev=697197&view=auto
==============================================================================
--- tiles/framework/trunk/src/site/apt/tutorial/advanced/el-support.apt (added)
+++ tiles/framework/trunk/src/site/apt/tutorial/advanced/el-support.apt Fri Sep
19 12:30:45 2008
@@ -0,0 +1,107 @@
+~~ $Id: nesting-extending.apt 695577 2008-09-15 18:47:00Z apetrelli $
+~~
+~~ 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.
+~~
+ -----------
+ Expression Language (EL) support
+ -----------
+
+Expression Language (EL) support
+
+ With Tiles it is possible to use EL not only in JSP pages, but also in XML
+ definition files.
+
+* Configuration
+
+ To enable EL support in XML definition files, you have to configure the
class of the
+ {{{../../apidocs/org/apache/tiles/evaluator/AttributeEvaluator.html}
AttributeEvaluator}}.
+
+ If you are using declarative configuration in <<<web.xml>>> file, you have
to use the
+
{{{../../config-reference.html#org.apache.tiles.evaluator.AttributeEvaluator}
org.apache.tiles.evaluator.AttributeEvaluator}}
+ parameter. In the case of <<<TilesServlet>>>:
+
+------------------------------------
+<servlet>
+ <servlet-name>tiles-init</servlet-name>
+ <servlet-class>org.apache.tiles.web.startup.TilesServlet</servlet-class>
+ <init-param>
+ <param-name>org.apache.tiles.evaluator.AttributeEvaluator</param-name>
+
<param-value>org.apache.tiles.evaluator.el.ELAttributeEvaluatr</param-value>
+ </init-param>
+</servlet>
+------------------------------------
+
+ If you are using programmatic configuration via Java, override the
+
{{{../../apidocs/org/apache/tiles/factory/BasicTilesContainerFactory.html#createEvaluator(java.lang.Object,%20org.apache.tiles.TilesApplicationContext,%20org.apache.tiles.context.TilesContextFactory,%20org.apache.tiles.locale.LocaleResolver)}
createEvaluator}}
+ method, providing <<only the creation>> of the instance of the
+ <<<AttributeEvaluator>>>.
+
+ If you are using Servlet 2.5 or above, you can leverage your container EL
support.
+
+------------------------------------
+ /** [EMAIL PROTECTED] */
+ @Override
+ protected AttributeEvaluator createEvaluator(Object context,
+ TilesApplicationContext applicationContext,
+ TilesContextFactory contextFactory, LocaleResolver resolver) {
+ ELAttributeEvaluator evaluator = new ELAttributeEvaluator();
+ evaluator.setApplicationContext(applicationContext);
+ MultiversionExpressionFactoryFactory efFactory = new
JspExpressionFactoryFactory();
+ efFactory.setApplicationContext(applicationContext);
+ evaluator.setExpressionFactory(efFactory.getExpressionFactory());
+ ELResolver elResolver = new CompositeELResolver() {
+ {
+ add(new TilesContextELResolver());
+ add(new TilesContextBeanELResolver());
+ add(new ArrayELResolver(false));
+ add(new ListELResolver(false));
+ add(new MapELResolver(false));
+ add(new ResourceBundleELResolver());
+ }
+ };
+ evaluator.setResolver(elResolver);
+
+ return evaluator;
+ }
+------------------------------------
+
+ If you are using Servlet 2.4, you still can use Tiles EL support but:
+
+ * You have to put <<<jasper-el-6.0.16.jar>>> (or newer version) in your
classpath.
+
+ * Use <<<TomcatExpressionFactoryFactory>>> instead of
+ <<<JspExpressionFactoryFactory>>>.
+
+* Usage
+
+ Let's use this example:
+
+------------------------------------
+ <definition name="test.composite.el.definition" template="${layout}"
+ preparer="org.apache.tiles.test.preparer.RequestSettingViewPreparer">
+ <put-attribute name="title" value="This is a configured composite
definition."/>
+ <put-attribute name="header" value="/header.jsp"/>
+ <put-attribute name="body" value="${requestScope.body}"/>
+ </definition>
+------------------------------------
+
+ Before rendering the definition:
+
+ * The template name will be taken from the "layout" attribute, searched in
every scope.
+
+ * The body will be taken from the "body" attribute in request scope.
Modified: tiles/framework/trunk/src/site/apt/tutorial/advanced/index.apt
URL:
http://svn.apache.org/viewvc/tiles/framework/trunk/src/site/apt/tutorial/advanced/index.apt?rev=697197&r1=697196&r2=697197&view=diff
==============================================================================
--- tiles/framework/trunk/src/site/apt/tutorial/advanced/index.apt (original)
+++ tiles/framework/trunk/src/site/apt/tutorial/advanced/index.apt Fri Sep 19
12:30:45 2008
@@ -44,4 +44,6 @@
[[8]] {{{menu.html}Menu-ing support}}
[[9]] {{{wildcard.html}Wildcard support}}
+
+ [[10]] {{{el-support.html}EL support}}
\ No newline at end of file
Modified: tiles/framework/trunk/src/site/apt/tutorial/index.apt
URL:
http://svn.apache.org/viewvc/tiles/framework/trunk/src/site/apt/tutorial/index.apt?rev=697197&r1=697196&r2=697197&view=diff
==============================================================================
--- tiles/framework/trunk/src/site/apt/tutorial/index.apt (original)
+++ tiles/framework/trunk/src/site/apt/tutorial/index.apt Fri Sep 19 12:30:45
2008
@@ -59,6 +59,8 @@
[[9]] {{{advanced/wildcard.html}Wildcard support}}
+ [[10]] {{{advanced/el-support.html}EL support}}
+
[[6]] {{{integration/index.html}Integration with other technologies}}
[[1]] {{{integration/frameworks.html}Integration with other
frameworks}}
Modified: tiles/framework/trunk/src/site/site.xml
URL:
http://svn.apache.org/viewvc/tiles/framework/trunk/src/site/site.xml?rev=697197&r1=697196&r2=697197&view=diff
==============================================================================
--- tiles/framework/trunk/src/site/site.xml (original)
+++ tiles/framework/trunk/src/site/site.xml Fri Sep 19 12:30:45 2008
@@ -107,6 +107,9 @@
<item
name="Wildcard support"
href="tutorial/advanced/wildcard.html"/>
+ <item
+ name="EL support"
+ href="tutorial/advanced/el-support.html"/>
</item>
<item
name="Integrations"