Yes, you can use the template as a way to accomplish composition, rather
than relying on inheritance.

Still, I think a common idiom is to define a base class for all pages in an
application that defines common resources (such as these assets), with
protected or public accessor methods.

On 5/16/07, Bill Holloway <[EMAIL PROTECTED]> wrote:

Well, I just finished building and inserting the "<t:menustylesheet
/>" component into the five page templates, and it was pretty dang
easy.  Nevermind.

On 5/16/07, Bill Holloway <[EMAIL PROTECTED]> wrote:
> I have several tapestry pages that all receive an injection of the
> exact same asset for use on the HTML page as a stylesheet link href:
>
> @Inject ("menu.css")
> private Asset _menuCss
>
> public Asset getMenuCss ()
> {
>     return _menuCss;
> }
>
> I would love to be able to encapsulate this bit of code, ideally, in a
> superclass.  But of course, inheritance is "bad" and the instance
> field must be private.
>
> I guess I could rig a "MenuStylesheet" component that would emit the
> full <link ... /> tag and inject the asset into MenuStylesheet.java,
> then put the <t:menustylesheet /> component into each of the pages.
> Maybe this is the "T5 way," but it seems like more work than
> necessary.
>
> Am I not seeing something more obvious?
>
> Bill
>
> --
> "The future is here.  It's just not evenly distributed yet."
>
>      -- Traditional
>


--
"The future is here.  It's just not evenly distributed yet."

     -- Traditional

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

Reply via email to