EL Expressions in Apache Tile Definition Not Processed

I use Apache tiles for templates, and part of the template is the title text. This text depends on the section to which the page belongs. Each page contains a bean, and the header text is built using the properties of this bean. bean will have a different name for each page. So, in my JSP file, I would have something like this:

<div>${myBean.id} - ${myBean.name}</div>

I want to get this expression in a fragment definition, and I tried this:

<definition template="/WEB-INF/tiles/layout/mytemplate.jsp">
  <put-attribute name="title" expression="${myBean.id} - ${myBean.name}" />
</definition>

And in the template, I do:

<div class="title-header"><tiles:insertAttribute name="title" /></div>

But the result is a raw EL expression:

<div>${myBean.id} - ${myBean.name}</div>

The code has been simplified here to keep this post concise, but this is exactly what I'm trying to do. There are also reasons why I am trying to do it this way.

Any idea why the EL expression is not being processed?

thank

. JSP Apache Tiles, , , .

+5
1

, ( ) . tiles-el.jar ( EL, , JAR MVEL OGNL).

2. AttributeEvaluator, , Spring:

<bean class="org.springframework.web.servlet.view.tiles2.TilesConfigurer">
    <property name="definitions">
        <list>
            <value>/WEB-INF/tiles/**/views.xml</value>
        </list>
    </property>

    <!-- Initialize expression language support for use in Tiles definitions. -->
    <property name="tilesProperties">
        <props>
            <prop key="org.apache.tiles.evaluator.AttributeEvaluator">org.apache.tiles.evaluator.el.ELAttributeEvaluator</prop>
        </props>
    </property>        
</bean>

3. Spring TilesConfigurer Tiles 3 JSP API 2.1 Tiles EL JAR. , EL-aware.

+6

All Articles