You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jeff Trent <jt...@structsoft.com> on 2001/04/30 21:09:41 UTC
How to embed bean:message within a template
Newbie here. Just wondering how to accomplish this using templates.
<template:put name='title' content='<bean:message key="app.title"/>' direct='true' />
Can't seem get the bean to evaluate the message text... Suggestions? I tried direct on & off but no luck.
Thanks,
Jeff
Re: How to embed bean:message within a template
Posted by John Raley <jo...@moonlight.com>.
Jeff,
Unfortunately you can't nest tags like this. One workaround is to write
an 'eval' tag that captures its contents into a page-scoped String
object. It's simple to write, and is a good exercise in taglib
authoring (I have one - maybe my boss won't mind if I post it).
So, your code would change to:
<mylib:eval id='myTitle'><bean:message key="app.title"/></mylib:eval>
<template:put name='title' content='<%=
pageContext.findAttribute("myTitle") %>' direct='true' />
Eval implementation left to the reader... :^)
Jeff Trent wrote:
> Newbie here. Just wondering how to accomplish this using templates.
> <template:put name='title' content='<bean:message key="app.title"/>'
> direct='true' />Can't seem get the bean to evaluate the message
> text... Suggestions? I tried direct on & off but no
> luck. Thanks,Jeff
RE: How to embed bean:message within a template
Posted by Niall Pemberton <ni...@btInternet.com>.
<template:put name="title" direct="true">
<bean:message key="index.title"/>
</template:put>
-----Original Message-----
From: Jeff Trent [mailto:jtrent@structsoft.com]
Sent: 30 April 2001 20:10
To: struts-user@jakarta.apache.o
Subject: How to embed bean:message within a template
Newbie here. Just wondering how to accomplish this using templates.
<template:put name='title' content='<bean:message key="app.title"/>'
direct='true' />
Can't seem get the bean to evaluate the message text... Suggestions? I
tried direct on & off but no luck.
Thanks,
Jeff