You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tiles.apache.org by Jose Luis Martinez Avial <jl...@pb-santander.com> on 2011/11/09 09:05:22 UTC
Tiles 2.1.4 /Struts 2.2.3 / EL Expressions
Hi,
I'm using Struts 2.2.3 with Tiles 2.1.4. It works
absolutely fine, but now I'm trying to use EL expressions, and I can't
get it to work. In Struts2 I can use <s:property
value="${getText('Dashboard.label')}"/> and it retrieves the message
from a bundle. I'd like to use the same on the Tiles Definition. So far
I've added the context-param to the web.xml
<context-param>
<param-name>org.apache.tiles.evaluator.AttributeEvaluator</param-name>
<param-value>org.apache.tiles.evaluator.el.ELAttributeEvaluator</param-v
alue>
</context-param>
Now I want to use the following expression on the
definition:
<put-attribute name="pane-title"
expression="${getText('Dashboard.label')}" cascade="true"/>
The issue is that when I do this, the screen fails to be
created saying:
Function ':getText' not found
So I suppose I'm missing something, but I don't know
why. Any ideas?
Thanks
JL
Internet communications are not secure and therefore Banco
Santander International does not accept legal responsibility for
the contents of this message. Any views or opinions presented
are solely those of the author and do not necessarily represent
those of Banco Santander International unless otherwise
specifically stated.
Las comunicaciones v'ia Internet no son seguras y, por lo tanto,
Banco Santander International no asume responsabilidad legal
ni de ning'un otro tipo por el contenido de este mensaje.
Cualquier opini'on transmitida pertenece 'unicamente al autor y
no necesariamente representa la opini'on de Banco Santander
International, a no ser que est'e expresamente detallado.
RE: Tiles 2.1.4 /Struts 2.2.3 / EL Expressions
Posted by Jose Luis Martinez Avial <jl...@pb-santander.com>.
That the solution I used. It's just that the title in some screens is
just a i18n string, which I wanted to define simply as
<put-attribute name="pane-title"
expression="${getText('Dashboard.label')}" cascade="true"/>
And in some other cases the tile would be a JSP, so I could use:
<put-attribute name="pane-title" value="/WEB-INF/jsp/my-title.jsp"
cascade="true"/>
And the template would look for the value of the expression or just
insert the JSP. What I've done is create a little JSP that can used for
that, so I add the following attributes to the definition
<put-attribute name="pane-title"
value="/WEB-INF/jsp/pane-title-text.jsp" cascade="true"/>
<put-attribute name="pane-title-key" value="Dashboard.label"
cascade="true"/>
And in pane-title-text.jsp:
<%@taglib prefix="s" uri="/struts-tags" %>
<%@taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles" %>
<tiles:importAttribute name="pane-title-key" />
<s:text name="%{#attr['pane-title-key']}"/>
And it works just fine. So I will use that, unless somebody has a better
idea.
Thanks
JL
-----Original Message-----
From: Antonio Petrelli [mailto:antonio.petrelli@gmail.com]
Sent: Wednesday, November 09, 2011 3:24 AM
To: users@tiles.apache.org
Subject: Re: Tiles 2.1.4 /Struts 2.2.3 / EL Expressions
2011/11/9 Jose Luis Martinez Avial <jl...@pb-santander.com>
>
> Now I want to use the following expression on the
> definition:
>
>
>
> <put-attribute name="pane-title"
> expression="${getText('Dashboard.label')}" cascade="true"/>
>
>
I am not absolutely sure, but I suppose that getText is a private EL
function of Struts 2. Since Tiles is not Struts 2, there is no way to
use it.
Only standard EL expressions are available.
Anyway, instead of doing a "put-attribute" of the title itself, do a
"put-attribute" of the title key, import the attribute and then use
<s:property> to retrieve the value from the bundle.
Antonio
Internet communications are not secure and therefore Banco
Santander International does not accept legal responsibility for
the contents of this message. Any views or opinions presented
are solely those of the author and do not necessarily represent
those of Banco Santander International unless otherwise
specifically stated.
Las comunicaciones v'ia Internet no son seguras y, por lo tanto,
Banco Santander International no asume responsabilidad legal
ni de ning'un otro tipo por el contenido de este mensaje.
Cualquier opini'on transmitida pertenece 'unicamente al autor y
no necesariamente representa la opini'on de Banco Santander
International, a no ser que est'e expresamente detallado.
Re: Tiles 2.1.4 /Struts 2.2.3 / EL Expressions
Posted by Antonio Petrelli <an...@gmail.com>.
2011/11/9 Jose Luis Martinez Avial <jl...@pb-santander.com>
>
> Now I want to use the following expression on the
> definition:
>
>
>
> <put-attribute name="pane-title"
> expression="${getText('Dashboard.label')}" cascade="true"/>
>
>
I am not absolutely sure, but I suppose that getText is a private EL
function of Struts 2. Since Tiles is not Struts 2, there is no way to use
it.
Only standard EL expressions are available.
Anyway, instead of doing a "put-attribute" of the title itself, do a
"put-attribute" of the title key, import the attribute and then use
<s:property> to retrieve the value from the bundle.
Antonio