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



>>> [EMAIL PROTECTED] 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: [EMAIL PROTECTED] 
For additional commands, e-mail: [EMAIL PROTECTED] 




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 [EMAIL PROTECTED]
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 [EMAIL PROTECTED] 

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


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to