tiles-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kai <...@ich-geh-kaputt.de>
Subject Re: EL-Expression in definition ignores page-scope
Date Mon, 10 Oct 2011 10:01:57 GMT
Am 10.10.2011 10:11, schrieb Antonio Petrelli:
> 2011/10/10 Kai<kai@ich-geh-kaputt.de>
>> In my real problem, list.jsp ist much more complex and I want to reuse it
>> on several pages. The only part of list.jsp which changes from page to page
>> is the part in dynamic.jsp, which is bind in in the definition.
>> Therefore I cannot "hartcode" the Template with a<t:insertAttribute>-Tag
>> inside the list.jsp-Template. Because then, I would have to copy list.jsp
>> for every page and would end up with several versions of list.jsp, which
>> only differ in this one<t:insertAttribute>-Tag. That would not be good,
>> because I would have to edit several nearly identical copies, if I want to
>> change list.jsp later on!
> Try to explain your use case further, maybe there are better solutions (e.g.
> ViewPreparer).
I am programming a picture-album.

There are severale pages, which are listing a set of pictures. For 
example, an import, a selected set of pictues, a picture-story, ... The 
markup for these picture-listings basically is the same on all these 
pages. Therefore, I would like to use one single template for that 
markup (the list.jsp in my simplified example).

But on every page-type, there are different Links for further actions 
beneath each listed picture. On the import-page there would be a 
rotate-link. On the page that lists selected pictures, there would be 
the links remove, move up and move down. On the picture-story-page there 
would be no links at all... Each set of links is a different 
sub-template (the dynamic.jsp in my simplified example).

Hence, I am looking for a way to embed different templates inside the 

A perfect match for one base-definition, which uses list.jsp as 
template, and a set of special definitions, which inherit from the base 
definition and overwrite an attribute (the attribute dynamic in my 
example), to insert an inner template with the specific links.

But then, on each insertion of that inner template, the inner template 
has to know the actual picture of the set of pictures, the outer 
template is iterating over.

That would work perfectly, if I would use <t:insertAttribute> in the 
outer template, as you have shown in your last mail. But I cannot do 
that, because I would need several versions of the outer template then. 
One for each specialised set of links, because for each set of 
specialised links, another template has to be included!

Hence, I tried to pick up the variable with an EL-Expression in the 

>> But I have understand, that the EL in the XML-definition is evaluated, when
>> the definition is inserted. In case of the nested anonymous definition, that
>> would happen while the forEach-Loop is renderd.
>> Therefore I had concluded that the EL sees the environment of that moment
>> and that page.
> It's true that EL is evaluated when the inserted page is rendered, but the
> *value* of the attribute is in the page that includes it.

I had expected, that the EL would behave in the same way it behaves, 
when it is written in the <t:insertAttribute>-Tag like in your last mail...

Greetings kai

View raw message