struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pilgrim, Peter" <>
Subject RE: Tiles with javascript heavy pages
Date Fri, 21 May 2004 11:15:02 GMT

> -----Original Message-----
> From: Joe Germuska []
> Sent: 20 May 2004 16:25
> To: Struts Users Mailing List
> Subject: RE: Tiles with javascript heavy pages
> >Do you know if you can embed the <tiles:getAsString /> inside the 
> ><bean:message>
> >to have the tiles attribute define the key for the bundle?
> You can never embed any JSP tag inside another JSP tag.
> You could use <bean:define> or <c:set> to create a page scoped 
> variable using tiles:getAsString and then use it for the key to 
> bean:message...
> <c:set var="thekey"><tiles:getAsString name="titleKey" /></c:set>
> <bean:message key="${thekey}" />
> This is assuming you're using the JSTL and struts-el, which is highly 
> recommended if you are on a Servlet 2.3/JSP 1.2 container (including 
> Tomcat 4 among others).
> Otherwise, it would look more like
> <bean:define name="thekey"><tiles:getAsString name="titleKey" 
> /></bean:define>
> <bean:message key="<%= thekey %>" />
> Joe

Yes the same solution if you use Struts Tiles definitions.
Say you have a definition, put the key of the message resource
as a value of a tile attribute.

<tiles-definition name=".simple.template" .... >
   <put name="pageTitle" value="" />

Obviously `' being found in the resource
bundle. Inside the Struts Tiles template do as Joe suggested
except I use JSTL fmt for my i18n ready apps
 <fmt:bundle basename="org.acme.FunkyPayRoll.Resources" />

 <c:set var="thekey"><tiles:getAsString name="pageTitle" /></c:set>

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

That's it.

Peter Pilgrim
Operations/IT - Credit Suisse First Boston, 10 South Colonnade, London E14 4QJ
United Kingdom
Tel: +44 (0)207 883 4447

This message is for the sole use of the intended recipient. If you received
this message in error please delete it and notify us. If this message was
misdirected, CSFB does not waive any confidentiality or privilege. CSFB
retains and monitors electronic communications sent through its network.
Instructions transmitted over this system are not binding on CSFB until they
are confirmed by us. Message transmission is not guaranteed to be secure.

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

View raw message