struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Raible <m...@raibledesigns.com>
Subject Setting the page title from a tile
Date Thu, 25 Sep 2003 13:51:08 GMT
I have an interesting problem that I can't figure out how to solve.

We are using Tiles, as well as a custom tag library that renders 
content from Velocity Templates.  These templates have HTML content in 
them, but they're mostly text - and this is our CMS (for now).  The 
problem is is that we've developed our app in a way only our menu needs 
to know about the templates.  So /appName/static/template will show the 
template page (wrapped in Tiles).  The problem is, by the time I load 
the Tile, with the template, the page's title has already been set.  
Sure I could use JavaScript and set document.title in the Velocity 
template, but that does no good for search engine optimization.  
Another solution I thought of is to put the title into the URL in my 
menus, i.e. 
/appName/static/homeownerServices?title=Homeowner%20Services - but 
that's just plain ol' ugly to send as a URL (via e-mail and such).

Two other solutions I can think of:

1.  Create a action-mapping and tile for each template (i.e. 
/appName/homeownerServices), and define the title in there.

2.  Parse the template name and convert it to readable titles.  This 
would require that I name all my templates so they have an appropriate 
title, but it just might work.  In this example, /homeownerServices 
gets translated to Homeowner Services as a title.

I guess I'll go with #2 (see how simply posting these messages actually 
helps to solve things!), but I wanted to see if anyone else had any 
good suggestions/practices.

Thanks,

Matt


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


Mime
View raw message