You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tiles.apache.org by stanlick <st...@gmail.com> on 2009/02/10 18:45:53 UTC
Migration from 2.1.1 to 2.1.2
I migrated my jars for a web app this morning and now EL expressions
contained in my tiles-defs.xml that had worked fine are displaying literal
expressions such as ${title}. Before downgrading the jars, does anyone know
if configuration changes someplace are necessary?
Peace,
Scott
--
View this message in context: http://www.nabble.com/Migration-from-2.1.1-to-2.1.2-tp21938867p21938867.html
Sent from the tiles users mailing list archive at Nabble.com.
Re: Struts2 + Tiles + i18n, getText issue
Posted by Antonio Petrelli <an...@gmail.com>.
As you can see by yourself, this is not a Tiles issue.
Keep asking in the Struts Users mailing list.
Antonio
2009/2/11 David Kerwick <Da...@hse.ie>:
> Hi all,
> Well I think I figured out what's happening but not why.
> I was using <s:debug/> and noticed
> session {WW_TRANS_I18N_LOCALE=ga}
> locale en_US
>
> With more than one tile in use the locale doesn't get changed I assume s:text reads off com.opensymphony.xwork2.ActionContext.locale
> and getText takes the default locale and that's why they are different.
>
> I can force the issue in my action
> if(session.containsKey("WW_TRANS_I18N_LOCALE")){
> Locale.setDefault((Locale) session.get("WW_TRANS_I18N_LOCALE"));
> }
> Which will work but isn't the nicest.
>
> I assume this is caused by something in my configuration or someone else would have come across it by now.
> Anyone any idea where I'm going wrong?
> Or any idea of a better way to fix the problem?
>
> Thanks
> Dave
>
> -----Original Message-----
> From: David Kerwick [mailto:David.Kerwick@hse.ie]
> Sent: 11 February 2009 09:53
> To: users@tiles.apache.org
> Subject: Struts2 + Tiles + i18n, getText issue
>
> Hi,
> I tried asking this of the struts list but got no response I was wondering of anyone here could help.
>
> The problem I have is these two statements give different results when the language is changed <s:property value="%{getText('test')}"/> <s:text name="test"/> when in a tile.
>
> With s:text giving the correct language text but getText always gives the default language text.
>
> The tiles definition I have is
>
> <definition name="test.basic" template="/WEB-INF/tiles/testTemplate.jsp">
> <put-attribute name="body" value="/test.jsp"/>
> <put-attribute name="navbar" value="/WEB-INF/pages/navBar.jsp"/>
> </definition>
>
> They both work correctly if there's only one tile i.e.
>
> <definition name="test.basic" template="/WEB-INF/tiles/testTemplate.jsp">
> <put-attribute name="body" value="/test.jsp"/>
> </definition>
>
> So it seems to be something to do with having multiple tiles but since s:text works I would have thought the i18n interceptor must be working.
> Anyone any idea why getText is ignoring the language?
> This happened for me when trying to localise labels i.e.
>
> <s:textfield key="surname" label="%{getText('surname')}"></s:textfield>
>
> I can get languages to work if I pass the body tile through an action i.e.
> <put-attribute name="body" value="/test.action"/>
> But that creates a whole set of other problems for me with validation.
>
> I'm using Struts struts-2.0.14 and the tiles bundle that comes with it, I have also tried tile-2.1.2.
> I change language using the code from HelloWorld.action
>
> <h3>Languages</h3>
> <ul>
> <li>
> <s:url id="url" action="test">
> <s:param name="request_locale">en</s:param>
> </s:url>
> <s:a href="%{url}">English</s:a>
> </li>
> <li>
> <s:url id="url" action="test">
> <s:param name="request_locale">ga</s:param>
> </s:url>
> <s:a href="%{url}">Irish</s:a>
> </li>
> </ul>
>
> Am I just doing something wrong? If so what should I be doing?
>
> Any help would be great
> Thanks
> Dave
>
RE: Struts2 + Tiles + i18n, getText issue
Posted by David Kerwick <Da...@hse.ie>.
Hi all,
Well I think I figured out what's happening but not why.
I was using <s:debug/> and noticed
session {WW_TRANS_I18N_LOCALE=ga}
locale en_US
With more than one tile in use the locale doesn't get changed I assume s:text reads off com.opensymphony.xwork2.ActionContext.locale
and getText takes the default locale and that's why they are different.
I can force the issue in my action
if(session.containsKey("WW_TRANS_I18N_LOCALE")){
Locale.setDefault((Locale) session.get("WW_TRANS_I18N_LOCALE"));
}
Which will work but isn't the nicest.
I assume this is caused by something in my configuration or someone else would have come across it by now.
Anyone any idea where I'm going wrong?
Or any idea of a better way to fix the problem?
Thanks
Dave
-----Original Message-----
From: David Kerwick [mailto:David.Kerwick@hse.ie]
Sent: 11 February 2009 09:53
To: users@tiles.apache.org
Subject: Struts2 + Tiles + i18n, getText issue
Hi,
I tried asking this of the struts list but got no response I was wondering of anyone here could help.
The problem I have is these two statements give different results when the language is changed <s:property value="%{getText('test')}"/> <s:text name="test"/> when in a tile.
With s:text giving the correct language text but getText always gives the default language text.
The tiles definition I have is
<definition name="test.basic" template="/WEB-INF/tiles/testTemplate.jsp">
<put-attribute name="body" value="/test.jsp"/>
<put-attribute name="navbar" value="/WEB-INF/pages/navBar.jsp"/>
</definition>
They both work correctly if there's only one tile i.e.
<definition name="test.basic" template="/WEB-INF/tiles/testTemplate.jsp">
<put-attribute name="body" value="/test.jsp"/>
</definition>
So it seems to be something to do with having multiple tiles but since s:text works I would have thought the i18n interceptor must be working.
Anyone any idea why getText is ignoring the language?
This happened for me when trying to localise labels i.e.
<s:textfield key="surname" label="%{getText('surname')}"></s:textfield>
I can get languages to work if I pass the body tile through an action i.e.
<put-attribute name="body" value="/test.action"/>
But that creates a whole set of other problems for me with validation.
I'm using Struts struts-2.0.14 and the tiles bundle that comes with it, I have also tried tile-2.1.2.
I change language using the code from HelloWorld.action
<h3>Languages</h3>
<ul>
<li>
<s:url id="url" action="test">
<s:param name="request_locale">en</s:param>
</s:url>
<s:a href="%{url}">English</s:a>
</li>
<li>
<s:url id="url" action="test">
<s:param name="request_locale">ga</s:param>
</s:url>
<s:a href="%{url}">Irish</s:a>
</li>
</ul>
Am I just doing something wrong? If so what should I be doing?
Any help would be great
Thanks
Dave
Struts2 + Tiles + i18n, getText issue
Posted by David Kerwick <Da...@hse.ie>.
Hi,
I tried asking this of the struts list but got no response I was wondering of anyone here could help.
The problem I have is these two statements give different results when the language is changed <s:property value="%{getText('test')}"/> <s:text name="test"/> when in a tile.
With s:text giving the correct language text but getText always gives the default language text.
The tiles definition I have is
<definition name="test.basic" template="/WEB-INF/tiles/testTemplate.jsp">
<put-attribute name="body" value="/test.jsp"/>
<put-attribute name="navbar" value="/WEB-INF/pages/navBar.jsp"/>
</definition>
They both work correctly if there's only one tile i.e.
<definition name="test.basic" template="/WEB-INF/tiles/testTemplate.jsp">
<put-attribute name="body" value="/test.jsp"/>
</definition>
So it seems to be something to do with having multiple tiles but since s:text works I would have thought the i18n interceptor must be working.
Anyone any idea why getText is ignoring the language?
This happened for me when trying to localise labels i.e.
<s:textfield key="surname" label="%{getText('surname')}"></s:textfield>
I can get languages to work if I pass the body tile through an action i.e.
<put-attribute name="body" value="/test.action"/>
But that creates a whole set of other problems for me with validation.
I'm using Struts struts-2.0.14 and the tiles bundle that comes with it, I have also tried tile-2.1.2.
I change language using the code from HelloWorld.action
<h3>Languages</h3>
<ul>
<li>
<s:url id="url" action="test">
<s:param name="request_locale">en</s:param>
</s:url>
<s:a href="%{url}">English</s:a>
</li>
<li>
<s:url id="url" action="test">
<s:param name="request_locale">ga</s:param>
</s:url>
<s:a href="%{url}">Irish</s:a>
</li>
</ul>
Am I just doing something wrong? If so what should I be doing?
Any help would be great
Thanks
Dave
Re: Migration from 2.1.1 to 2.1.2
Posted by Antonio Petrelli <an...@gmail.com>.
2009/2/10 stanlick <st...@gmail.com>:
>
> I migrated my jars for a web app this morning and now EL expressions
> contained in my tiles-defs.xml that had worked fine are displaying literal
> expressions such as ${title}. Before downgrading the jars, does anyone know
> if configuration changes someplace are necessary?
Due a security bug [1], I was forced to replace evaluation from the
"value" attributes to "expression". See the new tutorial page:
http://tiles.apache.org/framework/tutorial/advanced/el-support.html
Ciao
Antonio
[1] http://tiles.apache.org/framework/security/security-bulletin-1.html