struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Fumo, Vince" <>
Subject RE: using <fmt:message> with Tiles and Struts
Date Fri, 25 Mar 2005 19:38:25 GMT
That was close to the first way I went about it. I did the following:

<tiles:useAttribute name="titleKey" scope="page"/>

and then I was able to access the key just fine ( I did a test of <c:out
value="${titleKey}" /> and got "home.title"), proving that the problem
wasn't in the way I was using the tiles attribute. 

For some reason, when I plugged in :

<fmt:message key="${titleKey}"/>

I got the usual ???${titleKey}??? message from the fmt:message tag

Perhaps I'm doing something wrong somewhere. I even tried just doing the
following as a test:

<c:set var="titleKey" value="home.title"/>
<fmt:message key="${titleKey}"/>
<fmt:message key="home.title"/>

and I got the following:

Main Home Page

-----Original Message-----
From: Benedict, Paul C []
Sent: Friday, March 25, 2005 2:27 PM
To: 'Struts Users Mailing List'
Subject: RE: using <fmt:message> with Tiles and Struts


You need to import the Tiles attribute before you reference it:

  <tiles:importAttribute name="titleKey" ignore="true" />
  <c:out value="${titleKey}" />


-----Original Message-----
From: Fumo, Vince [] 
Sent: Friday, March 25, 2005 2:11 PM
To: ''
Subject: using <fmt:message> with Tiles and Struts

I am building a Struts Web application and I'm using Tiles for the first
time. I have it all set up and working nicely. My problem comes in the fact
that I want to use a standard messages.resources file for my page titles. 

For example

home.title=Main Home Page
info.title=Intro Page


I am used to setting the bundle at the top of the page like:

<fmt:setBundle basename="messages"/>

and then directly accessing keys as follows:

<fmt:message key="home.title"/>

however I am now using tiles so what I had hoped was to use a tiles
attribute to pass the key :

  <definition name=".home" extends=".baseDef">
   	<put name="titleKey"  value="title.home" />

and then use the key in the tile like:

<fmt:message key="${titleKey}"/>

however, nothing I've tried has worked (including just trying the
fmt:message tag w/o using Tiles like :
<c:set var="titleKey" value="home.title"/>) . 

For some reason, the fmt:message tag refuses to accept expression values. 

Can anyone offer me a best practice on how to handle this? Or at least solve
my problem?

Vincent Fumo
System Development Specialist
ACS Municipal Services
Government Systems
AIM : neodem2001

To unsubscribe, e-mail:
For additional commands, e-mail:

Notice:  This e-mail message, together with any attachments, contains
information of Merck & Co., Inc. (One Merck Drive, Whitehouse Station, New
Jersey, USA 08889), and/or its affiliates (which may be known outside the
United States as Merck Frosst, Merck Sharp & Dohme or MSD and in Japan, as
Banyu) that may be confidential, proprietary copyrighted and/or legally
privileged. It is intended solely for the use of the individual or entity
named on this message.  If you are not the intended recipient, and have
received this message in error, please notify us immediately by reply e-mail
and then delete it from your system.

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message