You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Troy Hart <th...@part.net> on 2001/03/23 22:27:04 UTC

using titles from an application resource file in my templates

I am using struts-template.tld and I want to be able to use my application
resources to get the correct title for any given page. I thought I had seen
this talked about somewhere but I can't find it anyplace in the mail
archives. I'm sure people that use struts templates must be doing this, but
I'm just not seeing how right now. It seems to me that I need a tag that
works similar to:

<bean:message key="somePage.title"/>

Except that it needs to expose a scripting variable with the value, instead
of writing it to the output stream. Maybe the message tag could be extended
to include an "id" parameter which, if set, stores the value in a page
scoped attribute with the given name... This way I could do something like
this:

...
<bean:message id="pageTitle" key="somePage.title"/>
<template:put name="title" content="<%= pageTitle %>" direct="true"/>
...

Maybe there is already a mechanism to cleanly accomplish this...any
pointers?


Thanks,

Troy


Re: using titles from an application resource file in my templates

Posted by Rob Leland <Ro...@freetocreate.org>.
Luckly someone answered this last week: 

 <template:put name="title" direct="true">
   <b> <bean:message key="publish.title" />  </b>
  </template:put>


Troy Hart wrote:
> 
> I am using struts-template.tld and I want to be able to use my application
> resources to get the correct title for any given page. I thought I had seen
> this talked about somewhere but I can't find it anyplace in the mail
> archives. I'm sure people that use struts templates must be doing this, but
> I'm just not seeing how right now. It seems to me that I need a tag that
> works similar to:
> 
> <bean:message key="somePage.title"/>
> 
> Except that it needs to expose a scripting variable with the value, instead
> of writing it to the output stream. Maybe the message tag could be extended
> to include an "id" parameter which, if set, stores the value in a page
> scoped attribute with the given name... This way I could do something like
> this:
> 
> ...
> <bean:message id="pageTitle" key="somePage.title"/>
> <template:put name="title" content="<%= pageTitle %>" direct="true"/>
> ...
> 
> Maybe there is already a mechanism to cleanly accomplish this...any
> pointers?
> 
> Thanks,
> 
> Troy