Hi team,
I've been looking at this pull request, and I like it. I understand its
value, but it raises a number of interesting challenges and questions.
*Summary*
Brett wants to support evaluation of expressions in the attributes of
<item>.
Sample use case:
<definition name="customers/orders" extends="customers/base">
<put-list-attribute name="breadcrumbs">
<item value="${customer.id}" link="/customers/${customer.id}" />
<item value="Orders" link="/customers/${customer.id}/salesOrders" />
<item value="${order.id}"
link="/customers/${customer.id}/salesOrders/${order.id}" />
</put-list-attribute>
<put-list-attribute name="body" cascade="true" inherit="true">
<add-attribute value="/WEB-INF/views/customers/cust-orders.jsp" />
</put-list-attribute>
</definition>
*Challenges*
- <item> and <bean> are excluded from Tiles 3.x, they are only supported
as backwards compatibility in tiles-compat, and only in the XML
definition file. They cannot be used as part of an inline definition
(through the use of
<tiles:definition><tiles:put-list-attribute>...</...> in a JSP template).
- This change would somehow break backwards compatibility (an old
application would display the string "${customer.id}" instead of
"12345", this might be expected by those applications that came all the
way from struts 1)
- All other tags in tiles-defs.xml require the developer to specify
explicitely that she wants the expression evaluated: <add-attribute
expression="${customer.id}"/> instead of <add-attribute value="Customer
ID"/>. Doing differently for <item> would make this XML even more
confusing that it already is.
*Questions*
- Do we want to keep maintaining <item> and <bean>, given that today DI
frameworks provide several better ways to declare those beans? Do we
want to reintegrate these out of tiles-compat into tiles-core?
- I see the value in merging the "value" and "expression" attributes.
However I do not think it should be done as part of a minor release in
TILES_3_0_X and not without automated tests. So IMHO options would be:
use the "expression" attribute in <item> for a uniform syntax and
backwards compatibility, or merge the "expression" and "value"
attributes accross the board in a major release (3.1?).
I think it is difficult to understand all aspects of Tiles as it is now,
and we should assist Brett in prefecting his design.
Please share your thoughts,
Thanks
Nick