forward port changes from TILES_3_0_X branch
 `svn merge -r1594481:1626663 ^/tiles/framework/branches/TILES_3_0_X .`


git-svn-id: https://svn.apache.org/repos/asf/tiles/framework/trunk@1626727 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/pom.xml b/pom.xml
index e48c4db..3fd9b1b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -318,7 +318,7 @@
         <tiles.osgi.private />
         <tiles.manifestfile>target/osgi/MANIFEST.MF</tiles.manifestfile>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-        <tiles.request.version>1.0.4</tiles.request.version>
+        <tiles.request.version>1.0.6</tiles.request.version>
         <tiles.autotag.version>1.1.0</tiles.autotag.version>
     </properties>
 
diff --git a/tiles-template/pom.xml b/tiles-template/pom.xml
index 964c7de..742e693 100644
--- a/tiles-template/pom.xml
+++ b/tiles-template/pom.xml
@@ -45,6 +45,7 @@
                 </goals>
                 <configuration>
                     <name>tiles</name>
+                    <requestClass>org.apache.tiles.request.Request</requestClass>
                 </configuration>
             </execution>
         </executions>
diff --git a/tiles-template/src/main/java/org/apache/tiles/template/GetAsStringModel.java b/tiles-template/src/main/java/org/apache/tiles/template/GetAsStringModel.java
index aae0538..1fc8295 100644
--- a/tiles-template/src/main/java/org/apache/tiles/template/GetAsStringModel.java
+++ b/tiles-template/src/main/java/org/apache/tiles/template/GetAsStringModel.java
@@ -174,7 +174,10 @@
             if (attribute == null && ignore) {
                 return;
             }
-            writer.write(attribute.getValue().toString());
+            Object value = container.evaluate(attribute, request);
+            if(value != null) {
+            	writer.write(value.toString());
+            }
         } catch (IOException e) {
             if (!ignore) {
                 throw e;
diff --git a/tiles-template/src/test/java/org/apache/tiles/template/GetAsStringModelTest.java b/tiles-template/src/test/java/org/apache/tiles/template/GetAsStringModelTest.java
index 800af45..cd26523 100644
--- a/tiles-template/src/test/java/org/apache/tiles/template/GetAsStringModelTest.java
+++ b/tiles-template/src/test/java/org/apache/tiles/template/GetAsStringModelTest.java
@@ -77,7 +77,7 @@
     @Test
     public void testExecute() throws IOException {
         TilesContainer container = createMock(TilesContainer.class);
-        Attribute attribute = new Attribute("myValue");
+        Attribute attribute = createMock(Attribute.class);
         AttributeContext attributeContext = createMock(AttributeContext.class);
         Request request = createMock(Request.class);
         Writer writer = createMock(Writer.class);
@@ -96,6 +96,7 @@
         expect(resolver.computeAttribute(container, attribute, "myName", "myRole", false, "myDefaultValue",
                 "myDefaultValueRole", "myDefaultValueType", request)).andReturn(attribute);
         expect(container.startContext(request)).andReturn(attributeContext);
+        expect(container.evaluate(attribute, request)).andReturn("myValue");
         writer.write("myValue");
         container.endContext(request);
 
diff --git a/tiles-test-pom/tiles-test/src/main/webapp/WEB-INF/tiles-defs.xml b/tiles-test-pom/tiles-test/src/main/webapp/WEB-INF/tiles-defs.xml
index 32411b7..a7d239d 100644
--- a/tiles-test-pom/tiles-test/src/main/webapp/WEB-INF/tiles-defs.xml
+++ b/tiles-test-pom/tiles-test/src/main/webapp/WEB-INF/tiles-defs.xml
@@ -47,6 +47,12 @@
       <put-attribute name="body"   value="/body.jsp"/>
   </definition>
 
+  <definition name="test.definition.expr" template="/layout.jsp">
+      <put-attribute name="title"  expression="This is the title."/>
+      <put-attribute name="header" value="/header.jsp"/>
+      <put-attribute name="body"   value="/body.jsp"/>
+  </definition>
+
   <definition name="test.definition.ignore" template="/layout_ignore.jsp">
       <put-attribute name="title"  value="This is the title."/>
       <put-attribute name="body"   value="/body.jsp"/>
@@ -66,6 +72,7 @@
 
   <definition name="test.definition.exception" template="/layout.jsp">
       <put-attribute name="title"  value="This is the title."/>
+      <put-attribute name="title"  value="This is the title."/>
       <put-attribute name="header" value="/exception.jsp"/>
       <put-attribute name="body"   value="/body.jsp"/>
   </definition>
diff --git a/tiles-test-pom/tiles-test/src/main/webapp/index.jsp b/tiles-test-pom/tiles-test/src/main/webapp/index.jsp
index 73c886d..f2e99a3 100644
--- a/tiles-test-pom/tiles-test/src/main/webapp/index.jsp
+++ b/tiles-test-pom/tiles-test/src/main/webapp/index.jsp
@@ -36,6 +36,7 @@
 
     <h3>Standard Render/Attribute Tests</h3>
     <a href="testinsertdefinition.jsp">Test Insert Configured Definition</a><br/>
+    <a href="testinsertdefinitionexpr.jsp">Test Insert Configured Definition With Expression</a><br/>
     <a href="testinsertdefinition_ignore.jsp">Test Insert Configured Definition with Ignore</a><br/>
     <a href="testinsertdefinition_flush.jsp">Test Insert Configured Definition with Flush</a><br/>
     <a href="testinsertdefinition_preparer.jsp">Test Insert Configured Definition with Preparer</a><br/>
diff --git a/tiles-test-pom/tiles-test/src/main/webapp/layout_expr.jsp b/tiles-test-pom/tiles-test/src/main/webapp/layout_expr.jsp
new file mode 100644
index 0000000..23d3cc0
--- /dev/null
+++ b/tiles-test-pom/tiles-test/src/main/webapp/layout_expr.jsp
@@ -0,0 +1,37 @@
+<%@ page session="false" %>
+<%--
+/*
+ * $Id$
+ *
+ * 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.
+ *
+ */
+--%>
+<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %>
+
+<table  border="2"  width="300"  bordercolor="Gray">
+  <tr>
+    <td  bgcolor="Blue"><strong><tiles:getAsString name="title"/></strong></td>
+  </tr>
+  <tr>
+    <td><tiles:insertAttribute name="header"/></td>
+  </tr>
+  <tr>
+    <td><tiles:insertAttribute name="body"/></td>
+  </tr>
+</table>           
\ No newline at end of file
diff --git a/tiles-test-pom/tiles-test/src/main/webapp/testinsertdefinitionexpr.jsp b/tiles-test-pom/tiles-test/src/main/webapp/testinsertdefinitionexpr.jsp
new file mode 100644
index 0000000..c296314
--- /dev/null
+++ b/tiles-test-pom/tiles-test/src/main/webapp/testinsertdefinitionexpr.jsp
@@ -0,0 +1,27 @@
+<%@ page session="false" %>
+<%--
+/*
+ * $Id$
+ *
+ * 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.
+ *
+ */
+--%>
+<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %>
+
+<tiles:insertDefinition name="test.definition.expr" />
diff --git a/tiles-test-pom/tiles-test/src/test/selenium/ConfiguredDefinitionExprTest.html b/tiles-test-pom/tiles-test/src/test/selenium/ConfiguredDefinitionExprTest.html
new file mode 100644
index 0000000..9b4d7fc
--- /dev/null
+++ b/tiles-test-pom/tiles-test/src/test/selenium/ConfiguredDefinitionExprTest.html
@@ -0,0 +1,61 @@
+<!--
+/*
+ * $Id$
+ *
+ * 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.
+ */
+-->
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>Configured Definition Test</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">Configured Definition With Expression Test</td></tr>
+</thead><tbody>
+<tr>
+	<td>open</td>
+	<td>/tiles-test/index.jsp</td>
+	<td></td>
+</tr>
+<tr>
+	<td>clickAndWait</td>
+	<td>link=Test Insert Configured Definition With Expression</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertTextPresent</td>
+	<td>This is the title.</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertTextPresent</td>
+	<td>This is the header</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertTextPresent</td>
+	<td>This is a body</td>
+	<td></td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/tiles-test-pom/tiles-test/src/test/selenium/TestSuite.html b/tiles-test-pom/tiles-test/src/test/selenium/TestSuite.html
index 2b669eb..89285f6 100644
--- a/tiles-test-pom/tiles-test/src/test/selenium/TestSuite.html
+++ b/tiles-test-pom/tiles-test/src/test/selenium/TestSuite.html
@@ -34,6 +34,9 @@
         <td><a href="ConfiguredDefinitionTest.html">Configured Definition Test</a></td>
     </tr>
     <tr>
+        <td><a href="ConfiguredDefinitionExprTest.html">Configured Definition With Expression Test</a></td>
+    </tr>
+    <tr>
         <td><a href="ConfiguredDefinitionIgnoreTest.html">Configured Definition with Ignore Test</a></td>
     </tr>
     <tr>