You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Graham Carlyle <gc...@accucard.com> on 2003/01/16 16:08:08 UTC

[tiles] suggested importAttribute improvement

I've started to use tiles recently and think its great way of enforcing 
consistency and reducing duplication across JSP pages. However the 
importAttribute tag doesn't feel right to me...

Rather than the importAttribute tag bringing all the parameterized 
variables into the page scope, how about a custom tag introducing just 
one named (or implicitly named) Map of the parameters?
This seems more consistent with the other JSP scoped attributes (page, 
request, session, application) as the tile parameters are just another 
scope.
To preserve backwards compatibility this tag could be named differently.

So rather than...
<tiles:importAttribute />
...
<c:out value="${foo}" />

How about...
<tiles:importArgs var="args"/>
...
<c:out value="${args.foo}" />

Admittedly this does make the tile more verbose, but it has the benefit 
of making clearer the distinction between a tile parameter and other 
page scope attributes.

This would also get round the need for the importAttribute tag's 
"ignore" attribute being set to true when a null parameter value is 
potentially passed into a tile.
The use of "ignore" attribute in this situation doesn't seem appropriate 
anyway as I am intentionally passing a null parameter into the tile.

Graham



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [tiles] suggested importAttribute improvement

Posted by Cedric Dumoulin <ce...@apache.org>.
  Hi,

  The <importAttribute > can already import attributes one by one, 
allowing to import only the relevant attributes:
  <tiles.importAttribute name="aName" />
  If you want to import an attribute under another name, you can use 
<tiles:useAttribute id="anotherName" name="aName" />
  What you want to do is to import all the attribute under a map. This 
make sense when used with jstl. Can you fill an enhancement request in 
struts bugzilla ?

      Cedric

Graham Carlyle wrote:

> I've started to use tiles recently and think its great way of 
> enforcing consistency and reducing duplication across JSP pages. 
> However the importAttribute tag doesn't feel right to me...
>
> Rather than the importAttribute tag bringing all the parameterized 
> variables into the page scope, how about a custom tag introducing just 
> one named (or implicitly named) Map of the parameters?
> This seems more consistent with the other JSP scoped attributes (page, 
> request, session, application) as the tile parameters are just another 
> scope.
> To preserve backwards compatibility this tag could be named differently.
>
> So rather than...
> <tiles:importAttribute />
> ...
> <c:out value="${foo}" />
>
> How about...
> <tiles:importArgs var="args"/>
> ...
> <c:out value="${args.foo}" />
>
> Admittedly this does make the tile more verbose, but it has the 
> benefit of making clearer the distinction between a tile parameter and 
> other page scope attributes.
>
> This would also get round the need for the importAttribute tag's 
> "ignore" attribute being set to true when a null parameter value is 
> potentially passed into a tile.
> The use of "ignore" attribute in this situation doesn't seem 
> appropriate anyway as I am intentionally passing a null parameter into 
> the tile.
>
> Graham
>
>
>
> -- 
> To unsubscribe, e-mail:   
> <ma...@jakarta.apache.org>
> For additional commands, e-mail: 
> <ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>