tiles-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Johannes Kuhs <johannes.k...@gmail.com>
Subject Re: lnherit and extend attribute value
Date Tue, 13 Oct 2009 13:02:45 GMT
On Tue, Oct 13, 2009 at 3:21 AM, Antonio Petrelli
<antonio.petrelli@gmail.com> wrote:
> 2009/10/12 excurser <excurser@yahoo.de>
>> Following up on this. I wrote a preparer class that I can reuse for
>> various attributes. However, so far I can only extend attributes that
>> have a string value associated with them. If an attribute links to a
>> file (e.g. /header.jsp) the the preparer adds the aux value to the
>> file name instead of the actual content in the file resulting in
>> something like:
>> /header.jsp--appended text here
>> This of course results in an error because there is not file called
>> "/header.jsp--appended text here". I guess the header attribute
>> content needs to be evaluated before adding the aux value. Is this
>> possible within the preparer class?
> Wait a minute, in this case there is something that I don't understand. What
> do you mean with "appending text" in this case?
> Antonio

Hi Antonio,

Thanks for your reply! Basically, I want to append new content to
existing content of an attribute. For example, if I had a body.jsp
file with the following content:

<div>This is the initial content</div>

My configuration would look like this:

<definition name="test.definition" template="/layout.jsp">
      <put-attribute name="body"   value="/body.jsp"/>

Now, in my test.jsp file I would like to extend the body content. Or
in other words I would like to append new content to the body.
Something like the following would be perfect but if I can somehow do
it with a preparer that would be fine too.

<tiles:insertDefinition name="test.definition">
 <tiles:putAttribute name="body" inherit=”true”>
     <div>This text gets appended to the initial content of the body

Now, when inserting the body attribute in /layout.jsp with the following code:

<tiles:insertAttribute name="body"/>

The following content should be inserted:
<div>This is the initial content</div>
<div>This text gets appended to the initial content of the body attribute</div>

The preparer allowed me to append text but only if the attribute value
was defined as string, e.g. <put-attribute name="body"   value="My
initial value as string"/>
However, I would like to append content to a linked file as well.

In your opinion, what would be the best way to achieve this? Also,
what do you think about the idea of adding an "inherit" attribute for
the "putAttribute" tag? The same functionality already exists for
lists so I think it would make sense to have it for normal attributes
as well, wouldn't it?

Thank you very much for your help!

View raw message