You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Holman, Cal" <CH...@Paymentech.com> on 2001/05/06 22:28:38 UTC

template flexability

Since using the template tag as follows is always direct=true how can you
make the xxx in the template put="xxx" variable.  The reason for the
substitution is to make the heading variable based on language or
application  - while still using the same template.  Does anyone have a
technique for changing the source page using the proprieties file??
 
welcome.jsp
 
<template:insert template='/tableTemplate.jsp'>
 
<template:put name='header' direct='false'> <bean:message key="heading.page"
/> </template:put>
 
<template:put name='title' direct='true'> <bean:message key="welcome.title"
/> </template:put>
 
</template:insert>
 
Will not work since the body on a template:put  is considered direct='true'
 
welcome.jsp
 
<template:insert template='/tableTemplate.jsp'>
 
<template:put name='header' content='<bean:message key="heading.page" />' />
 
<template:put name='title' direct='true'> <bean:message key="welcome.title"
/> </template:put>
 
</template:insert>
 
Will not work because the inclosing bean:message is not expanded.
 
 
 
The in the template is the get
 
tableTemplate.jsp
 
    <td valign="top"><template:get name='header'/></td>
 
Cal
 

Re: template flexability

Posted by Cedric Dumoulin <ce...@lifl.fr>.
  Hi Cal,

  I don't know the reason why actual template implementation always turn
'true' the direct attribute when the body is used (David ?). Also, the
getDirect() method of PutTag doesn't take into account the real value of
'direct', just its presence ! Maybe this behavior need to be changed.

  Meanwhile, if you want to try your solution, you can use the
Components implementation in place of Templates. Components allow to use
direct='true' with the tag body. There is also other mechanisms that
could interest you.

  Cedric

Components sites :
  http://www.lifl.fr/~dumoulin/components/
  (mirror) : http://www.geocities.com/cedricdumoulin/components/



"Holman, Cal" wrote:

> Since using the template tag as follows is always direct=true how can
> you make the xxx in the template put=”xxx” variable.The reason for the
> substitution is to make the heading variable based on language or
> application- while still using the same template.Does anyone have a
> technique for changing the source page using the proprieties file??
> welcome.jsp
>
> <template:insert template='/tableTemplate.jsp'>
>
> <template:put name='header' direct='false'> <bean:message
> key="heading.page" /> </template:put>
>
> <template:put name='title' direct='true'> <bean:message
> key="welcome.title" /> </template:put>
>
> </template:insert>
>
> Will not work since the body on a template:put is considered
> direct=’true’
>
> welcome.jsp
>
> <template:insert template='/tableTemplate.jsp'>
>
> <template:put name='header' content=’<bean:message key="heading.page"
> />’ />
>
> <template:put name='title' direct='true'> <bean:message
> key="welcome.title" /> </template:put>
>
> </template:insert>
>
> Will not work because the inclosing bean:message is not expanded.
>
> The in the template is the get
>
> tableTemplate.jsp
>
> <td valign="top"><template:get name='header'/></td>
>
> Cal
>