tiles-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick R <ric...@gmail.com>
Subject Re: should be super easy - but I'm screwing up using extends/nested..
Date Mon, 29 Aug 2011 17:33:51 GMT
On Mon, Aug 29, 2011 at 1:26 PM, Rick R <rickcr@gmail.com> wrote:

>
>
> On Mon, Aug 29, 2011 at 1:13 PM, Antonio Petrelli <
> antonio.petrelli@gmail.com> wrote:
>
>> 2011/8/29 Rick R <rickcr@gmail.com>
>>
>> > What is driving me crazy though is "How would you accomplish this
>> "without"
>> > using cascade='true' ?" (In fact I think the application I'll eventually
>> > have to integrate with is using a very old version of Tiles (1?) that
>> > doesn't have cascade? )
>> >
>> > You mentioned above "Either you define a new definition that uses
>> > plainBody.jsp... ," which I 'think'  I did in the above pastie with
>> > "plain.body" and 'standard.body' definitions, but if I give it an
>> attribute
>> > of content which I expected to be overridden, it's not overridden. As an
>> > example in the below I'll end up with "foo bar 2" as the content instead
>> of
>> > the 'signup' definition put-attribute content (if I remove cascade =
>> true
>> > on
>> > the signup put-attribute .)
>> >
>> > <definition name="plain.body"
>> > templateExpression="/WEB-INF/layouts/plainBody.jsp">
>> >     <put-attribute name="content" value="foo bar 2"/> <!-- never really
>> > overridden ??? -->
>> > </definition>
>> >
>>
>> Probably, anonymous nested definitions best fits your needs:
>>
>> http://tiles.apache.org/2.2/framework/tutorial/advanced/nesting-extending.html#Anonymous_nested_definitions
>>
>>
>
>
> I tried that at first, but didn't have any luck. Here is how I set it up,
> but the problem is "content" in plainBody.jsp is not overridden in pageBody.
> You'll see OVERRIDE ME show up, and without that put-attribute it complains
> that it's needed.
>
>
> <definition name="plainLayout"
> templateExpression="/WEB-INF/layouts/page.jsp">
> <put-attribute name="title" value="My App" />
>  <put-attribute name="pageBody">
> <definition templateExpression="/WEB-INF/layouts/plainBody.jsp">
>  <put-attribute name="content" value="OVERRIDE ME"/>
> </definition>
>  </put-attribute>
> </definition>
>
> <definition name="signup" extends="plainLayout">
>  <put-attribute name="content" value="/WEB-INF/views/signup/signup.jsp"/>
> </definition>
>
>
>
>

Oh, I see something like this maybe (which works, although definitely more
verbose):

<definition name="signup" extends="base.definition">
 <put-attribute name="pageBody">
<definition templateExpression="/WEB-INF/layouts/plainBody.jsp">
 <put-attribute name="content" value="/WEB-INF/views/signup/signup.jsp"/>
</definition>
 </put-attribute>
</definition>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message