struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Scott Piker" <scott_pi...@polk.com>
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:

tiles-defs.xml:
*------------
  <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>
  <definition name="page.a" extends="app.base">
	  <put name="title"   		value = "pageA.titleKey" />
	  <put name="body"  		value = "/pageA.jsp" />
  </definition>

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:

baseTemplate.jsp:
*------------
<%@ 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" />
</tiles:insert>
...


Then just use this attribute in your header.jsp.  

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


HTH,
- Scott



>>> mailinglisten_und_anderes@web.de 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>
</HEAD>
<BODY>
<tiles:insert attribute="head" />
<tiles:insert attribute="content" />
<tiles:insert attribute="footer" />
</BODY>

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?

Bye

Christian 
________________________________________________________________
Verschicken Sie romantische, coole und witzige Bilder per SMS!
Jetzt neu bei WEB.DE FreeMail: http://freemail.web.de/?mc=021193 


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




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 Do_Not_Send@polk.com
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 postmaster@polk.com 

***************************************************************************** 


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


Mime
View raw message