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: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to