You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Regalut <re...@hotmail.com> on 2008/05/26 14:01:59 UTC

I18n In title with dynamic parameters

Hi:

I am doing an web application with struts 2 and tiles 2, and want that the
title, of every page, is internationalized and furthermore that will contain
dynamic parameters.

example: "Information of Nokia N95", being Nokia N95 the title of a product,
that is to say a dynamic information.

tiles.xml
<definition name="common.layout" template="/common/layout.jsp">
        <put-attribute name="tituloKey" value="" />
        <put-attribute name="tituloKeyParam1" value=""/>
...
</definition>
<definition name="pages.product" extends="common.layout">
        <put-attribute name="tituloKey" value="title.product" />
        <put-attribute name="tituloKeyParam1" value="%{product.title}" />
        <put-attribute name="contenido" value="/pages/product.jsp" />
</definition>

layout.jsp;
<tiles:importAttribute name="tituloKey"/>
<tiles:importAttribute name="tituloKeyParam1"/>
<title>
        <s:text name="%{#attr['tituloKey']}">
                <s:param value="%{#attr['tituloKeyParam1']}"/>
        </s:text>
</title>

ApplicationResources.properties:
title.product = Information of {0}

The problem is that if an action takes to me to pages.product the title
shows me " Information of %{product.title} "

How I can solve this?

Thanks.
-- 
View this message in context: http://www.nabble.com/I18n-In-title-with-dynamic-parameters-tp17470656p17470656.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: I18n In title with dynamic parameters

Posted by Regalut <re...@hotmail.com>.
Ok.If I do <s:text name="%{#attr['tituloKey']}">, first he assesses the
#attr['tituloKey'] value and then it does s:text, so it´s as if do <s:text
name="title.product">.

I thought that would do the same with s:param, ie, evaluates
%{#attr['tituloKeyParam1']}, and then makes s:param, ie would do <s:param
value="%{product.title}"/>. But this is not true.

In addition I have also tried to do:
<s:set name="temp"><tiles:getAsString name="tituloKeyParam1"></s:set>
<s:param value="#temp"/>
With the idea that temp had %{product.title} value, and therefore would be
evaluated
<s:param value="%{product.title}"/>

But it does not work, s:set doesn´t allocate the body value to the variable
temp. I believe this was already Fixed since version 2.0.7 (I use the
2.0.11.1), did I do something wrong?
-- 
View this message in context: http://www.nabble.com/I18n-In-title-with-dynamic-parameters-tp17470656p17472580.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org