tiles-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jose Luis Martinez Avial" <jlmarti...@pb-santander.com>
Subject RE: Tiles 2.1.4 /Struts 2.2.3 / EL Expressions
Date Wed, 09 Nov 2011 08:31:43 GMT
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 <jlmartinez@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.

Mime
View raw message