title: Tile does not work properly with OGNL expressions
body: <p>I am trying to use OGNL in my tile but it considers the expression as a string ( whatever I use it counts as a string).</p>
  
  <p>How should I change it in a way to count the expression as name of a page not string.</p>
  
  <p>I am using the following code to embed the jsp file name, when admin user is logged in it replace ROLE_ADMIN with the @com.... expression but does not load menuRole_Admin.jsp page. It just shows menuRole_Admin.jsp as a string on browser.</p>
  
  <pre><code> &lt;put-attribute name="menu" expression="OGNL: 'menu' + 
                           @com.myproject.controller.Default@getRole() + '.jsp'"/&gt; 
  </code></pre>
  
  <p><strong>tile.xml</strong></p>
  
  <pre><code> &lt;tiles-definitions&gt;
           ....
          &lt;definition name="register1" extends="baseLayout"&gt;
            &lt;put-attribute name="menu" expression="OGNL: 'menu' + 
                        @com.myproject.controller.Default@getRole() + '.jsp'"/&gt; 
              &lt;put-attribute name="body" value="/body.jsp"/&gt;
          &lt;/definition&gt;
          ......
  </code></pre>
  
  <p><strong>basLayout.jsp</strong></p>
  
  <pre><code>&lt;%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %&gt;
  &lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
      "http://www.w3.org/TR/html4/loose.dtd"&gt;
  &lt;%@taglib uri="/struts-tags" prefix="s"%&gt;
  &lt;%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %&gt;
  &lt;%@taglib uri="/struts-dojo-tags" prefix="sx" %&gt;
  &lt;html&gt;
      &lt;head&gt;
          ....
      &lt;/head&gt;
      &lt;body&gt;
          &lt;div id="container"&gt;
              &lt;div id="banner"&gt;
                  &lt;tiles:insertAttribute name="header" /&gt;
              &lt;/div&gt;
              &lt;div id="menu"&gt;
                  &lt;tiles:insertAttribute name="menu"/&gt;
              &lt;/div&gt;
              &lt;div id="content"&gt;
                  &lt;tiles:insertAttribute name="body"/&gt;
              &lt;/div&gt;
              &lt;div id="footer"&gt;
                  &lt;tiles:insertAttribute name="footer" /&gt;
              &lt;/div&gt;
          &lt;/div&gt;  
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>pom.xml</strong></p>
  
  <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" 
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
                               http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
         ..........
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.struts&lt;/groupId&gt;
              &lt;artifactId&gt;struts2-core&lt;/artifactId&gt;
              &lt;version&gt;2.3.8&lt;/version&gt;
          &lt;/dependency&gt;
           &lt;dependency&gt;
              &lt;groupId&gt;org.mortbay.jetty&lt;/groupId&gt;
              &lt;artifactId&gt;jsp-2.1-glassfish&lt;/artifactId&gt;
              &lt;version&gt;9.1.02.B04.p0&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.struts&lt;/groupId&gt;
              &lt;artifactId&gt;struts2-convention-plugin&lt;/artifactId&gt;
              &lt;version&gt;2.3.14&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.struts&lt;/groupId&gt;
              &lt;artifactId&gt;struts2-dojo-plugin&lt;/artifactId&gt;
              &lt;version&gt;2.3.14&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.struts&lt;/groupId&gt;
              &lt;artifactId&gt;struts-taglib&lt;/artifactId&gt;
              &lt;version&gt;1.3.10&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.glassfish.extras&lt;/groupId&gt;
              &lt;artifactId&gt;glassfish-embedded-static-shell&lt;/artifactId&gt;
              &lt;version&gt;3.1.1&lt;/version&gt;
              &lt;scope&gt;system&lt;/scope&gt;
              &lt;systemPath&gt;${glassfish.embedded-static-shell.jar}&lt;/systemPath&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.kenai.nbpwr&lt;/groupId&gt;
              &lt;artifactId&gt;org-apache-commons-dbcp&lt;/artifactId&gt;
              &lt;version&gt;1.2.2-201002241055&lt;/version&gt;
              &lt;type&gt;nbm&lt;/type&gt;
          &lt;/dependency&gt;
            &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-webmvc&lt;/artifactId&gt;
              &lt;version&gt;3.0.7.RELEASE&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.security&lt;/groupId&gt;
              &lt;artifactId&gt;spring-security-web&lt;/artifactId&gt;
              &lt;version&gt;3.0.7.RELEASE&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.security&lt;/groupId&gt;
              &lt;artifactId&gt;spring-security-core&lt;/artifactId&gt;
              &lt;version&gt;3.0.7.RELEASE&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.security&lt;/groupId&gt;
              &lt;artifactId&gt;spring-security-taglibs&lt;/artifactId&gt;
              &lt;version&gt;3.0.7.RELEASE&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.security&lt;/groupId&gt;
              &lt;artifactId&gt;spring-security-config&lt;/artifactId&gt;
              &lt;version&gt;3.0.7.RELEASE&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;commons-dbutils&lt;/groupId&gt;
              &lt;artifactId&gt;commons-dbutils&lt;/artifactId&gt;
              &lt;version&gt;1.5&lt;/version&gt;
              &lt;type&gt;jar&lt;/type&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;struts&lt;/groupId&gt;
              &lt;artifactId&gt;struts&lt;/artifactId&gt;
              &lt;version&gt;1.2.9&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
              &lt;artifactId&gt;jstl&lt;/artifactId&gt;
              &lt;version&gt;1.2&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.taglibs&lt;/groupId&gt;
              &lt;artifactId&gt;taglibs-parent&lt;/artifactId&gt;
              &lt;version&gt;3&lt;/version&gt;
              &lt;type&gt;pom&lt;/type&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax.xml&lt;/groupId&gt;
              &lt;artifactId&gt;jaxrpc&lt;/artifactId&gt;
              &lt;version&gt;1.1&lt;/version&gt;
              &lt;type&gt;pom&lt;/type&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;taglibs&lt;/groupId&gt;
              &lt;artifactId&gt;fmt&lt;/artifactId&gt;
              &lt;version&gt;1.1.2&lt;/version&gt;
              &lt;type&gt;tld&lt;/type&gt;
          &lt;/dependency&gt;
           &lt;dependency&gt;
          &lt;groupId&gt;commons-beanutils&lt;/groupId&gt;
          &lt;artifactId&gt;commons-beanutils&lt;/artifactId&gt;
          &lt;version&gt;1.8.0&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
      &lt;groupId&gt;commons-digester&lt;/groupId&gt;
      &lt;artifactId&gt;commons-digester&lt;/artifactId&gt;
      &lt;version&gt;2.0&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;commons-io&lt;/groupId&gt;
              &lt;artifactId&gt;commons-io&lt;/artifactId&gt;
              &lt;version&gt;1.3.2&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;net.sf.opencsv&lt;/groupId&gt;
              &lt;artifactId&gt;opencsv&lt;/artifactId&gt;
              &lt;version&gt;2.3&lt;/version&gt;
              &lt;type&gt;jar&lt;/type&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.struts&lt;/groupId&gt;
              &lt;artifactId&gt;struts2-tiles3-plugin&lt;/artifactId&gt;
              &lt;version&gt;2.3.14&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.tiles&lt;/groupId&gt;
              &lt;artifactId&gt;tiles-el&lt;/artifactId&gt;
              &lt;version&gt;3.0.1&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.tiles&lt;/groupId&gt;
              &lt;artifactId&gt;tiles-ognl&lt;/artifactId&gt;
              &lt;version&gt;3.0.1&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.tiles&lt;/groupId&gt;
              &lt;artifactId&gt;tiles-api&lt;/artifactId&gt;
              &lt;version&gt;3.0.1&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.tiles&lt;/groupId&gt;
              &lt;artifactId&gt;tiles-core&lt;/artifactId&gt;
              &lt;version&gt;3.0.1&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.tiles&lt;/groupId&gt;
              &lt;artifactId&gt;tiles-extras&lt;/artifactId&gt;
              &lt;version&gt;3.0.1&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.tiles&lt;/groupId&gt;
              &lt;artifactId&gt;tiles-jsp&lt;/artifactId&gt;
              &lt;version&gt;3.0.1&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.tiles&lt;/groupId&gt;
              &lt;artifactId&gt;tiles-servlet&lt;/artifactId&gt;
              &lt;version&gt;3.0.1&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;jdom&lt;/groupId&gt;
              &lt;artifactId&gt;jdom&lt;/artifactId&gt;
              &lt;version&gt;b10&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
              &lt;artifactId&gt;slf4j-simple&lt;/artifactId&gt;
              &lt;version&gt;1.6.4&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax&lt;/groupId&gt;
              &lt;artifactId&gt;javaee-web-api&lt;/artifactId&gt;
              &lt;version&gt;6.0&lt;/version&gt;
              &lt;type&gt;jar&lt;/type&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;axis&lt;/groupId&gt;
              &lt;artifactId&gt;axis&lt;/artifactId&gt;
              &lt;version&gt;1.4&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;commons-discovery&lt;/groupId&gt;
              &lt;artifactId&gt;commons-discovery&lt;/artifactId&gt;
              &lt;version&gt;0.2&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;commons-logging&lt;/groupId&gt;
              &lt;artifactId&gt;commons-logging&lt;/artifactId&gt;
              &lt;version&gt;1.1.1&lt;/version&gt;
          &lt;/dependency&gt;
            &lt;dependency&gt;
              &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
              &lt;artifactId&gt;slf4j-log4j12&lt;/artifactId&gt;
              &lt;version&gt;1.5.6&lt;/version&gt;
          &lt;/dependency&gt;
       &lt;dependency&gt;
  &lt;groupId&gt;log4j&lt;/groupId&gt;
  &lt;artifactId&gt;log4j&lt;/artifactId&gt;
  &lt;version&gt;1.2.15&lt;/version&gt;
  &lt;exclusions&gt;
      &lt;exclusion&gt;
          &lt;groupId&gt;com.sun.jmx&lt;/groupId&gt;
          &lt;artifactId&gt;jmxri&lt;/artifactId&gt;
      &lt;/exclusion&gt;
      &lt;exclusion&gt;
          &lt;groupId&gt;com.sun.jdmk&lt;/groupId&gt;
          &lt;artifactId&gt;jmxtools&lt;/artifactId&gt;
      &lt;/exclusion&gt;
      &lt;exclusion&gt;
              &lt;groupId&gt;javax.jms&lt;/groupId&gt;
              &lt;artifactId&gt;jms&lt;/artifactId&gt;
      &lt;/exclusion&gt;
  &lt;/exclusions&gt;
  &lt;/dependency&gt;
              &lt;dependency&gt;
      &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
      &lt;artifactId&gt;slf4j-api&lt;/artifactId&gt;
      &lt;version&gt;1.5.6&lt;/version&gt;
  &lt;/dependency&gt;
  
      &lt;/dependencies&gt;
  
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
                  &lt;version&gt;2.3.2&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;source&gt;1.6&lt;/source&gt;
                      &lt;target&gt;1.6&lt;/target&gt;
                      &lt;compilerArguments&gt;
                          &lt;endorseddirs&gt;${endorsed.dir}&lt;/endorseddirs&gt;
                      &lt;/compilerArguments&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-war-plugin&lt;/artifactId&gt;
                  &lt;version&gt;2.1.1&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;failOnMissingWebXml&gt;false&lt;/failOnMissingWebXml&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-dependency-plugin&lt;/artifactId&gt;
                  &lt;version&gt;2.1&lt;/version&gt;
                  &lt;executions&gt;
                      &lt;execution&gt;
                          &lt;phase&gt;validate&lt;/phase&gt;
                          &lt;goals&gt;
                              &lt;goal&gt;copy&lt;/goal&gt;
                          &lt;/goals&gt;
                          &lt;configuration&gt;
                              &lt;outputDirectory&gt;${endorsed.dir}&lt;/outputDirectory&gt;
                              &lt;silent&gt;true&lt;/silent&gt;
                              &lt;artifactItems&gt;
                                  &lt;artifactItem&gt;
                                     &lt;groupId&gt;javax&lt;/groupId&gt;
                                     &lt;artifactId&gt;javaee-endorsed-api&lt;/artifactId&gt;
                                     &lt;version&gt;6.0&lt;/version&gt;
                                     &lt;type&gt;jar&lt;/type&gt;
                                  &lt;/artifactItem&gt;
                              &lt;/artifactItems&gt;
                          &lt;/configuration&gt;
                      &lt;/execution&gt;
                  &lt;/executions&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  
  &lt;/project&gt;
  </code></pre>
  
  <p><strong>web.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" 
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
       xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-
       app_3_0.xsd"&gt;
      &lt;context-param&gt;
          &lt;param-name&gt;org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG&lt;/param-name&gt;
          &lt;param-value&gt;/WEB-INF/tiles.xml&lt;/param-value&gt;
      &lt;/context-param&gt;
     &lt;listener&gt;
          &lt;listener-class&gt;org.apache.tiles.extras.complete.CompleteAutoloadTilesListener&lt;/listener-
         class&gt;
      &lt;/listener&gt;
         &lt;listener&gt;
          &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt;  
      &lt;/listener&gt;
       &lt;context-param&gt; 
          &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt; 
          &lt;param-value&gt;
              /WEB-INF/applicationContext.xml
              /WEB-INF/myProject-security.xml 
              /WEB-INF/login-service.xml
          &lt;/param-value&gt; 
      &lt;/context-param&gt; 
      &lt;filter&gt; 
          &lt;filter-name&gt;springSecurityFilterChain&lt;/filter-name&gt; 
          &lt;filter-class&gt; 
              org.springframework.web.filter.DelegatingFilterProxy 
          &lt;/filter-class&gt; 
      &lt;/filter&gt; 
  
      &lt;filter-mapping&gt; 
          &lt;filter-name&gt;springSecurityFilterChain&lt;/filter-name&gt; 
          &lt;url-pattern&gt;/*&lt;/url-pattern&gt; 
      &lt;/filter-mapping&gt;
      &lt;filter&gt;
          &lt;filter-name&gt;struts2&lt;/filter-name&gt;
          &lt;filter-
        class&gt;org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter&lt;/filter-class&gt;
      &lt;/filter&gt;
      &lt;filter-mapping&gt;
          &lt;filter-name&gt;struts2&lt;/filter-name&gt;
          &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
      &lt;/filter-mapping&gt;
      &lt;session-config&gt;
          &lt;session-timeout&gt;
              30
          &lt;/session-timeout&gt;
      &lt;/session-config&gt;
      &lt;welcome-file-list&gt;
          &lt;welcome-file&gt;index.jsp&lt;/welcome-file&gt;
      &lt;/welcome-file-list&gt;
  &lt;/web-app&gt;
  </code></pre>
  
  <p><strong>applicationContext.xml</strong></p>
  
  <pre><code>&lt;?xml version='1.0' encoding='UTF-8'?&gt; 
  &lt;beans xmlns='http://www.springframework.org/schema/beans' 
                  xmlns:context='http://www.springframework.org/schema/context' 
                  xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' 
                  xsi:schemaLocation='http://www.springframework.org/schema/beans
          http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
          http://www.springframework.org/schema/context    
      http://www.springframework.org/schema/context/spring-context-3.0.xsd'&gt;
  
      &lt;context:component-scan base-package='com.myProject'/&gt; 
      &lt;bean id='internalResourceResolver' 
                   class='org.springframework.web.servlet.view.InternalResourceViewResolver'&gt; 
          &lt;property name='prefix' value='/Web Pages/'/&gt; 
          &lt;property name='suffix' value='.jsp'/&gt; 
      &lt;/bean&gt; 
      &lt;bean class='org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping'/&gt;
      &lt;bean class='org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter'/&gt; 
      &lt;bean id='placeholderConfig' 
                   class='org.springframework.beans.factory.config.PropertyPlaceholderConfigurer'/&gt; 
  &lt;/beans&gt;
  </code></pre>
  
  <p><strong>myproject-security.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans:beans xmlns='http://www.springframework.org/schema/security' 
          xmlns:beans='http://www.springframework.org/schema/beans' 
              xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' 
              xsi:schemaLocation='http://www.springframework.org/schema/beans 
      http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
      http://www.springframework.org/schema/security
      http://www.springframework.org/schema/security/spring-security-3.0.xsd'&gt;
  &lt;beans:import resource='login-service.xml'/&gt; 
  &lt;http auto-config="true" access-denied-page="/notFound.jsp" use-expressions="true"&gt;
      &lt;intercept-url pattern="/search/view*" access="hasRole('ROLE_ADMIN')" /&gt; 
      &lt;form-login login-page="/index" 
                  authentication-failure-url="/index?error=1"
                  default-target-url="/default"/&gt; 
      &lt;remember-me/&gt;
       &lt;logout logout-success-url="/index.jsp"/&gt;
  &lt;/http&gt; 
  &lt;authentication-manager&gt; 
            ...........
  </code></pre>
  
  <p>Quaternion commented : I just realized you have Struts2, Spring-MVC AND Struts 1 all included in the same project... that is pretty weird. – </p>