"Johan Compagner" <[EMAIL PROTECTED]> writes:


> look at the bean:message tag:
> 
> <bean:message key="title"/>
> 
> johan

Hi Johan, 

this does not help me. <bean:message key="title" /> prints 
the internationalized word Title. But I want to use it in
the template to print various titles. 


Example (without the headers):

ApplicationResources.properties
===============================

app.login=Login
app.logout=Logout

ApplicationResources_de.properties
==================================

app.login=Anmelden
app.logout=Abmelden


now the template files:

template.jsp
============

...
<head><title><template:get name="title" /></title></head>
...


login.jsp
=========

<template:insert template='/template.jsp'>
  <template:put name='title' content='Login' direct='true'/>
  ...
</template:insert>


logout.jsp
==========

<template:insert template='/template.jsp'>
  <template:put name='title' content='Logout' direct='true'/>
  ...
</template:insert>


As you can see, I have to insert the words "Login" and "Logout" 
into the files login.jsp and logout.jsp literally, instead of
inserting the keys "app.login" and "app.logout"


Of course I could use the scripplet approach and use


<template:put name='title' 
              content='<%= resources.getMessage(locale, "app.login") %>'
              direct='true' />

instead. But is there a nicer way?

Something like: 

<template:put name='title' direct='true'>
    <bean:message key='app.login' />
</template:put>


Groetjes

--
gR



Reply via email to