2011/8/29 Rick R <[email protected]> > On Mon, Aug 29, 2011 at 1:26 PM, Rick R <[email protected]> wrote: > > > > > > > On Mon, Aug 29, 2011 at 1:13 PM, Antonio Petrelli < > > [email protected]> wrote: > > > >> 2011/8/29 Rick R <[email protected]> > >> > >> > 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> >
It's not verbose, it's right. Antonio
