struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Scott Piker" <>
Subject Re: Struts Tiles and Internationalization
Date Wed, 27 Oct 2004 13:24:40 GMT
It's actually pretty straightforward.  Just define a "title" attribute in your tiles-defs,
as you would any other attribute.  Override it for each page that requires a different title.
 For example:

  <definition name="app.base" path="/tiles/layouts/baseTemplate.jsp">
	  <put name="title"   		value = "app.titleKey" />
	  <put name="header"  		value = "/tiles/header.jsp" />
	  <put name="body"  		value = "/tiles/blank_body.jsp" />
  <definition name="page.a" extends="app.base">
	  <put name="title"   		value = "pageA.titleKey" />
	  <put name="body"  		value = "/pageA.jsp" />

Then, adjust your templates so that your header tile renders the <head> and <title>
html tags.  Pass the "title" attribute into your header tile when inserting it:

<%@ taglib uri="/WEB-INF/struts-tiles.tld"  prefix="tiles" %>
<tiles:importAttribute />
<html:html locale="true">
<tiles:insert attribute="header">
    <tiles:put name="title" beanName="title" />

Then just use this attribute in your header.jsp.  

<%@ taglib uri="/WEB-INF/struts-tiles.tld"  prefix="tiles" %>
<%@ taglib uri="/WEB-INF/struts-html.tld"  prefix="html" %>
<tiles:importAttribute />
    <title><bean:message name="title"/></title>

- Scott

>>> 10/27/2004 3:26:14 AM >>>
Hi all!

I have a small problem:

I am creating a web-application with struts, which contains many jsp-pages. At the moment
I use the concept copy & pasting the layout into each page. I read much about including
parts by jsp-commands, templates and tiles and try to use tiles. But I do have one big problem
with that:

I have my template looking like that: 

<TITLE><tiles:getAsString name="title" /></TITLE>
<tiles:insert attribute="head" />
<tiles:insert attribute="content" />
<tiles:insert attribute="footer" />

I know, it looks nice, but I have the problem, that each page has to choose another title,
which is in my Ressource-Properties and to make it more complicated, I develop it with internationalization.
I also have to use the title in the "head"-section, but I think the reuse is no problem.

How can I configure a key, which will be resolved in the RessourceBundles to give me the language-
and page-dependent title?

Any suggestions?


Verschicken Sie romantische, coole und witzige Bilder per SMS!
Jetzt neu bei WEB.DE FreeMail: 

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

This message has originated from R.L. Polk & Co.,
26955 Northwestern Highway Southfield, MI 48034

R. L. Polk & Co. sends various types of e-mail
communications. If this email message concerns the
potential licensing of a Polk product or service, and
you do not wish to receive further emails regarding Polk
products, forward this email to
with the word "remove" in the subject line.

The email and any files transmitted with it are confidential
and intended solely for the individual or entity to whom they
are addressed.

If you have received this email in error please delete this message
and notify the Polk System Administrator at 


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

View raw message