Templates and t:body

classic Classic list List threaded Threaded
20 messages Options
Reply | Threaded
Open this post in threaded view
|

Templates and t:body

bobheck
I am really confused and in need of some clarification.

The templates documentation for Tapestry 5
(http://tapestry.formos.com/nightly/tapestry5/tapestry-core/guide/templa
tes.html) shows this (direct copy/paste):

============================
The following example is a Layout component, that adds basic HTML
elements around the page specific content:

<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
    <head>
        <title>My Tapestry Application</title>
    </head>
    <body>
        <t:body/>
    </body>
</html>

A page would use this component as follow:

<t:layout
xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">

  My Page Specific Content

</t:layout>

When the page renders, the page's template and the Border component's
template are merged together:

<html>
  <head>
    <title>My Tapestry Application</title>
  </head>
  <body>
    My Page Specific Content
  </body>
</html>
==============================


1.  I thought a layout component should start with t:layout, someone
please clarify if the first block is actually a layout component.

2.  I will assume (not sure this is correct, though) that the
introductory sentences are reversed and the layout component is actually
the second block, i.e.:

<t:layout
xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">

  My Page Specific Content

</t:layout>


And, the page is actually the first block, i.e.:

<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
    <head>
        <title>My Tapestry Application</title>
    </head>
    <body>
        <t:body/>
    </body>
</html>


3.  Given that #2 assumption is correct, I still do not understand how
the page inserts the layout template in the body.  There is no id given
to the template, so where is the linking between the two? Is there a
specific name given to the template file?  If so, it is not explained or
even mentioned.

4.  The sentence "When the page renders, the page's template and the
Border component's template are merged together:" is confusing as well,
as I read elsewhere that there is no Border component in T5.


Am I missing something very basic here?  I just can't seem to get a
handle.  All I want to do is include menus/navigation in other pages,
does not seem like it should be that hard.

Thanks in advance for your help.

Bob




Reply | Threaded
Open this post in threaded view
|

RE: Templates and t:body

jonabarker
Bob,

The documentation is correct, but requires some getting used to.

A layout component is more of a design pattern (like the Border in T4).  It
is designed to be wrapped around something.  That something appears where
you see <t:body />

The naming is by convention.  I'm still using a T4 convention, so I actually
use a <t:border /> rather than a <t:layout />, because I created a component
named Border rather than one named Layout.  You could call it anything you
want!

When you use <t:layout />, in your page, it's like saying, "Take everything
inside of this tag and put in into Layout where you see <t:body />".

I hope that helps.

Jonathan


> -----Original Message-----
> From: Heck, Bob [mailto:[hidden email]]
> Sent: Thursday, October 18, 2007 11:37 AM
> To: Tapestry users
> Subject: Templates and t:body
>
> I am really confused and in need of some clarification.
>
> The templates documentation for Tapestry 5
> (http://tapestry.formos.com/nightly/tapestry5/tapestry-core/guide/templa
> tes.html) shows this (direct copy/paste):
>
> ============================
> The following example is a Layout component, that adds basic HTML
> elements around the page specific content:
>
> <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
>     <head>
>         <title>My Tapestry Application</title>
>     </head>
>     <body>
>         <t:body/>
>     </body>
> </html>
>
> A page would use this component as follow:
>
> <t:layout
> xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
>
>   My Page Specific Content
>
> </t:layout>
>
> When the page renders, the page's template and the Border component's
> template are merged together:
>
> <html>
>   <head>
>     <title>My Tapestry Application</title>
>   </head>
>   <body>
>     My Page Specific Content
>   </body>
> </html>
> ==============================
>
>
> 1.  I thought a layout component should start with t:layout, someone
> please clarify if the first block is actually a layout component.
>
> 2.  I will assume (not sure this is correct, though) that the
> introductory sentences are reversed and the layout component is actually
> the second block, i.e.:
>
> <t:layout
> xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
>
>   My Page Specific Content
>
> </t:layout>
>
>
> And, the page is actually the first block, i.e.:
>
> <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
>     <head>
>         <title>My Tapestry Application</title>
>     </head>
>     <body>
>         <t:body/>
>     </body>
> </html>
>
>
> 3.  Given that #2 assumption is correct, I still do not understand how
> the page inserts the layout template in the body.  There is no id given
> to the template, so where is the linking between the two? Is there a
> specific name given to the template file?  If so, it is not explained or
> even mentioned.
>
> 4.  The sentence "When the page renders, the page's template and the
> Border component's template are merged together:" is confusing as well,
> as I read elsewhere that there is no Border component in T5.
>
>
> Am I missing something very basic here?  I just can't seem to get a
> handle.  All I want to do is include menus/navigation in other pages,
> does not seem like it should be that hard.
>
> Thanks in advance for your help.
>
> Bob
>
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

RE: Templates and t:body

bobheck
Thanks for the reply.

Ok, the page specific content:

 <t:layout
 xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
 
   My Page Specific Content
 
 </t:layout>

is stored in its own .tml file, right?  Call it specific.tml


Now, the layout template, as specified by the documentation, is

 <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
     <head>
         <title>My Tapestry Application</title>
     </head>
     <body>
         <t:body/>
     </body>
 </html>

and that is stored I its own .tml file, call it layout.tml


So, how does layout.tml know to use specific.tml to fill in the
<t:body/> tag?  Does it have to be injected somehow?  Where does it get
a reference? How is this done?




-----Original Message-----
From: Jonathan Barker [mailto:[hidden email]]
Sent: Thursday, October 18, 2007 10:56
To: 'Tapestry users'
Subject: RE: Templates and t:body

Bob,

The documentation is correct, but requires some getting used to.

A layout component is more of a design pattern (like the Border in T4).
It is designed to be wrapped around something.  That something appears
where you see <t:body />

The naming is by convention.  I'm still using a T4 convention, so I
actually use a <t:border /> rather than a <t:layout />, because I
created a component named Border rather than one named Layout.  You
could call it anything you want!

When you use <t:layout />, in your page, it's like saying, "Take
everything inside of this tag and put in into Layout where you see
<t:body />".

I hope that helps.

Jonathan


> -----Original Message-----
> From: Heck, Bob [mailto:[hidden email]]
> Sent: Thursday, October 18, 2007 11:37 AM
> To: Tapestry users
> Subject: Templates and t:body
>
> I am really confused and in need of some clarification.
>
> The templates documentation for Tapestry 5
> (http://tapestry.formos.com/nightly/tapestry5/tapestry-core/guide/temp
> la
> tes.html) shows this (direct copy/paste):
>
> ============================
> The following example is a Layout component, that adds basic HTML
> elements around the page specific content:
>
> <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
>     <head>
>         <title>My Tapestry Application</title>
>     </head>
>     <body>
>         <t:body/>
>     </body>
> </html>
>
> A page would use this component as follow:
>
> <t:layout
> xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
>
>   My Page Specific Content
>
> </t:layout>
>
> When the page renders, the page's template and the Border component's
> template are merged together:
>
> <html>
>   <head>
>     <title>My Tapestry Application</title>
>   </head>
>   <body>
>     My Page Specific Content
>   </body>
> </html>
> ==============================
>
>
> 1.  I thought a layout component should start with t:layout, someone
> please clarify if the first block is actually a layout component.
>
> 2.  I will assume (not sure this is correct, though) that the
> introductory sentences are reversed and the layout component is
> actually the second block, i.e.:
>
> <t:layout
> xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
>
>   My Page Specific Content
>
> </t:layout>
>
>
> And, the page is actually the first block, i.e.:
>
> <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
>     <head>
>         <title>My Tapestry Application</title>
>     </head>
>     <body>
>         <t:body/>
>     </body>
> </html>
>
>
> 3.  Given that #2 assumption is correct, I still do not understand how

> the page inserts the layout template in the body.  There is no id
> given to the template, so where is the linking between the two? Is
> there a specific name given to the template file?  If so, it is not
> explained or even mentioned.
>
> 4.  The sentence "When the page renders, the page's template and the
> Border component's template are merged together:" is confusing as
> well, as I read elsewhere that there is no Border component in T5.
>
>
> Am I missing something very basic here?  I just can't seem to get a
> handle.  All I want to do is include menus/navigation in other pages,
> does not seem like it should be that hard.
>
> Thanks in advance for your help.
>
> Bob
>
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Templates and t:body

Thiago H de Paula Figueiredo
On Thu, 18 Oct 2007 13:05:48 -0300, Heck, Bob <[hidden email]> wrote:

> So, how does layout.tml know to use specific.tml to fill in the
> <t:body/> tag?  Does it have to be injected somehow?  Where does it get
> a reference? How is this done?

<t:body> just renders whatever was put inside your <t:layout> tag. ;)
The specific page uses the layout, not the inverse.


--
Thiago H. de Paula Figueiredo
Desenvolvedor, Instrutor e Consultor de Tecnologia
Eteg Tecnologia da Informação Ltda.
http://www.eteg.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Templates and t:body

angelochen
Something interesting: if <t:body></t:body> you will get some runtime warning, but <t:body /> everything's fine.

Thiago H. de Paula Figueiredo wrote
On Thu, 18 Oct 2007 13:05:48 -0300, Heck, Bob <bob.heck@eds.com> wrote:

> So, how does layout.tml know to use specific.tml to fill in the
> <t:body/> tag?  Does it have to be injected somehow?  Where does it get
> a reference? How is this done?

<t:body> just renders whatever was put inside your <t:layout> tag. ;)
The specific page uses the layout, not the inverse.


--
Thiago H. de Paula Figueiredo
Desenvolvedor, Instrutor e Consultor de Tecnologia
Eteg Tecnologia da Informação Ltda.
http://www.eteg.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Reply | Threaded
Open this post in threaded view
|

Re: Templates and t:body

Matheus Eduardo Machado Moreira-3
In reply to this post by bobheck
    Hi, Bob.

    When the specific.tml page is requested, Tapestry asks its components to
render themselves to generate the response. So, when <t:layout> on
specific.tml is asked to generate content, it knows that its body is "My
Page Specific Content". The content written by the component is:

<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
    <head>
        <title>My Tapestry Application</title>
    </head>
    <body>
        <!-- my comment: t:body is replaced by the actual body -->
        My Page Specific Content
    </body>
</html>

    So, you don't have to inject anything. The component knows what its body
is and know that it must be placed where <t:body> appears.

    Atenciosamente,

Matheus Eduardo Machado Moreira
[hidden email]

"Violence is the last refuge of the incompetent."
        Salvor Hardin (The Foundation, Isaac Asimov)

2007/10/18, Heck, Bob <[hidden email]>:

>
> Thanks for the reply.
>
> Ok, the page specific content:
>
> <t:layout
> xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
>
>    My Page Specific Content
>
> </t:layout>
>
> is stored in its own .tml file, right?  Call it specific.tml
>
>
> Now, the layout template, as specified by the documentation, is
>
> <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
>      <head>
>          <title>My Tapestry Application</title>
>      </head>
>      <body>
>          <t:body/>
>      </body>
> </html>
>
> and that is stored I its own .tml file, call it layout.tml
>
>
> So, how does layout.tml know to use specific.tml to fill in the
> <t:body/> tag?  Does it have to be injected somehow?  Where does it get
> a reference? How is this done?
>
>
>
>
> -----Original Message-----
> From: Jonathan Barker [mailto:[hidden email]]
> Sent: Thursday, October 18, 2007 10:56
> To: 'Tapestry users'
> Subject: RE: Templates and t:body
>
> Bob,
>
> The documentation is correct, but requires some getting used to.
>
> A layout component is more of a design pattern (like the Border in T4).
> It is designed to be wrapped around something.  That something appears
> where you see <t:body />
>
> The naming is by convention.  I'm still using a T4 convention, so I
> actually use a <t:border /> rather than a <t:layout />, because I
> created a component named Border rather than one named Layout.  You
> could call it anything you want!
>
> When you use <t:layout />, in your page, it's like saying, "Take
> everything inside of this tag and put in into Layout where you see
> <t:body />".
>
> I hope that helps.
>
> Jonathan
>
>
> > -----Original Message-----
> > From: Heck, Bob [mailto:[hidden email]]
> > Sent: Thursday, October 18, 2007 11:37 AM
> > To: Tapestry users
> > Subject: Templates and t:body
> >
> > I am really confused and in need of some clarification.
> >
> > The templates documentation for Tapestry 5
> > (http://tapestry.formos.com/nightly/tapestry5/tapestry-core/guide/temp
> > la
> > tes.html) shows this (direct copy/paste):
> >
> > ============================
> > The following example is a Layout component, that adds basic HTML
> > elements around the page specific content:
> >
> > <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
> >     <head>
> >         <title>My Tapestry Application</title>
> >     </head>
> >     <body>
> >         <t:body/>
> >     </body>
> > </html>
> >
> > A page would use this component as follow:
> >
> > <t:layout
> > xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
> >
> >   My Page Specific Content
> >
> > </t:layout>
> >
> > When the page renders, the page's template and the Border component's
> > template are merged together:
> >
> > <html>
> >   <head>
> >     <title>My Tapestry Application</title>
> >   </head>
> >   <body>
> >     My Page Specific Content
> >   </body>
> > </html>
> > ==============================
> >
> >
> > 1.  I thought a layout component should start with t:layout, someone
> > please clarify if the first block is actually a layout component.
> >
> > 2.  I will assume (not sure this is correct, though) that the
> > introductory sentences are reversed and the layout component is
> > actually the second block, i.e.:
> >
> > <t:layout
> > xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
> >
> >   My Page Specific Content
> >
> > </t:layout>
> >
> >
> > And, the page is actually the first block, i.e.:
> >
> > <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
> >     <head>
> >         <title>My Tapestry Application</title>
> >     </head>
> >     <body>
> >         <t:body/>
> >     </body>
> > </html>
> >
> >
> > 3.  Given that #2 assumption is correct, I still do not understand how
>
> > the page inserts the layout template in the body.  There is no id
> > given to the template, so where is the linking between the two? Is
> > there a specific name given to the template file?  If so, it is not
> > explained or even mentioned.
> >
> > 4.  The sentence "When the page renders, the page's template and the
> > Border component's template are merged together:" is confusing as
> > well, as I read elsewhere that there is no Border component in T5.
> >
> >
> > Am I missing something very basic here?  I just can't seem to get a
> > handle.  All I want to do is include menus/navigation in other pages,
> > does not seem like it should be that hard.
> >
> > Thanks in advance for your help.
> >
> > Bob
> >
> >
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|

RE: Templates and t:body

bobheck
In reply to this post by Thiago H de Paula Figueiredo
<t:layout> and <t:body> are in two separate files.  How does that work?

 

-----Original Message-----
From: Thiago H de Paula Figueiredo [mailto:[hidden email]]
Sent: Thursday, October 18, 2007 12:17
To: Tapestry users
Subject: Re: Templates and t:body

On Thu, 18 Oct 2007 13:05:48 -0300, Heck, Bob <[hidden email]> wrote:

> So, how does layout.tml know to use specific.tml to fill in the
> <t:body/> tag?  Does it have to be injected somehow?  Where does it
> get a reference? How is this done?

<t:body> just renders whatever was put inside your <t:layout> tag. ;) The specific page uses the layout, not the inverse.


--
Thiago H. de Paula Figueiredo
Desenvolvedor, Instrutor e Consultor de Tecnologia Eteg Tecnologia da Informação Ltda.
http://www.eteg.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

RE: Templates and t:body

bobheck
In reply to this post by Thiago H de Paula Figueiredo
Or, maybe I should just start at the top.

I have a header that I want to display on every page.  That header html (tml) markup is stored in the file header.tml

How do I include this in another file, say hello.tml?  What is the syntax and component usage?



-----Original Message-----
From: Thiago H de Paula Figueiredo [mailto:[hidden email]]
Sent: Thursday, October 18, 2007 12:17
To: Tapestry users
Subject: Re: Templates and t:body

On Thu, 18 Oct 2007 13:05:48 -0300, Heck, Bob <[hidden email]> wrote:

> So, how does layout.tml know to use specific.tml to fill in the
> <t:body/> tag?  Does it have to be injected somehow?  Where does it
> get a reference? How is this done?

<t:body> just renders whatever was put inside your <t:layout> tag. ;) The specific page uses the layout, not the inverse.


--
Thiago H. de Paula Figueiredo
Desenvolvedor, Instrutor e Consultor de Tecnologia Eteg Tecnologia da Informação Ltda.
http://www.eteg.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Templates and t:body

Marcus Veloso
Hi Bob,

Header.tml:
<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
<head>....</head>
<body>....

<t:body/>   <!--  This tag will render your Hello.tml -->

</body>
</html>


Hello.tml:
<t:Header xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
Hello Word!
</t:Header>


Marcus
Reply | Threaded
Open this post in threaded view
|

RE: Templates and t:body

jonabarker
In reply to this post by bobheck

I should type faster (and stop eating).  Lots of good responses to your
questions.

If all you want to do is include a header, then you don't need to use the
layout pattern, so header.tml can be something like:

<h1>some standard header</h1>

And that's it.

The layout pattern is handy if you want to be able to have things like
menus, or standard CSS files, and change the arrangement of your application
without modifying every page.  For example, you could move from a menu on
the left to a menu across the top by only changing your Layout component.  I
tend to us the Layout pattern for the long-term flexibility.

Jonathan



> -----Original Message-----
> From: Heck, Bob [mailto:[hidden email]]
> Sent: Thursday, October 18, 2007 12:27 PM
> To: Tapestry users
> Subject: RE: Templates and t:body
>
> Or, maybe I should just start at the top.
>
> I have a header that I want to display on every page.  That header html
> (tml) markup is stored in the file header.tml
>
> How do I include this in another file, say hello.tml?  What is the syntax
> and component usage?
>
>
>
> -----Original Message-----
> From: Thiago H de Paula Figueiredo [mailto:[hidden email]]
> Sent: Thursday, October 18, 2007 12:17
> To: Tapestry users
> Subject: Re: Templates and t:body
>
> On Thu, 18 Oct 2007 13:05:48 -0300, Heck, Bob <[hidden email]> wrote:
>
> > So, how does layout.tml know to use specific.tml to fill in the
> > <t:body/> tag?  Does it have to be injected somehow?  Where does it
> > get a reference? How is this done?
>
> <t:body> just renders whatever was put inside your <t:layout> tag. ;) The
> specific page uses the layout, not the inverse.
>
>
> --
> Thiago H. de Paula Figueiredo
> Desenvolvedor, Instrutor e Consultor de Tecnologia Eteg Tecnologia da
> Informação Ltda.
> http://www.eteg.com.br
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

RE: Templates and t:body

jonabarker
In reply to this post by bobheck
Sorry, I only answered half of your question.

Including your standard header into hello.tml would be something like:

<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
    <head>
        <title>My Tapestry Application</title>
    </head>
    <body>
          <t:header />
        My Page Specific Content
    </body>
</html>


> -----Original Message-----
> From: Heck, Bob [mailto:[hidden email]]
> Sent: Thursday, October 18, 2007 12:27 PM
> To: Tapestry users
> Subject: RE: Templates and t:body
>
> Or, maybe I should just start at the top.
>
> I have a header that I want to display on every page.  That header html
> (tml) markup is stored in the file header.tml
>
> How do I include this in another file, say hello.tml?  What is the syntax
> and component usage?
>
>
>
> -----Original Message-----
> From: Thiago H de Paula Figueiredo [mailto:[hidden email]]
> Sent: Thursday, October 18, 2007 12:17
> To: Tapestry users
> Subject: Re: Templates and t:body
>
> On Thu, 18 Oct 2007 13:05:48 -0300, Heck, Bob <[hidden email]> wrote:
>
> > So, how does layout.tml know to use specific.tml to fill in the
> > <t:body/> tag?  Does it have to be injected somehow?  Where does it
> > get a reference? How is this done?
>
> <t:body> just renders whatever was put inside your <t:layout> tag. ;) The
> specific page uses the layout, not the inverse.
>
>
> --
> Thiago H. de Paula Figueiredo
> Desenvolvedor, Instrutor e Consultor de Tecnologia Eteg Tecnologia da
> Informação Ltda.
> http://www.eteg.com.br
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

RE: Templates and t:body

angelochen
Hi Jonathan,

I tried your approach, but does not work, here is my steps:

1. create a Header.html in component directory, it has only one line:

hi my heading

2. I use it in my start.html:

<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
<head>
    <title>Start Page</title>
</head>
<body>

Start Page

    <t:Header />
</body>
</html>

It complains:Unable to resolve component type 'Header' to a component class name.

Anything I'm missing here? Thanks,
A.C.

Jonathan Barker wrote
Sorry, I only answered half of your question.

Including your standard header into hello.tml would be something like:

<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
    <head>
        <title>My Tapestry Application</title>
    </head>
    <body>
          <t:header />
        My Page Specific Content
    </body>
</html>


> -----Original Message-----
> From: Heck, Bob [mailto:bob.heck@eds.com]
> Sent: Thursday, October 18, 2007 12:27 PM
> To: Tapestry users
> Subject: RE: Templates and t:body
>
> Or, maybe I should just start at the top.
>
> I have a header that I want to display on every page.  That header html
> (tml) markup is stored in the file header.tml
>
> How do I include this in another file, say hello.tml?  What is the syntax
> and component usage?
>
>
>
> -----Original Message-----
> From: Thiago H de Paula Figueiredo [mailto:thiagohp@gmail.com]
> Sent: Thursday, October 18, 2007 12:17
> To: Tapestry users
> Subject: Re: Templates and t:body
>
> On Thu, 18 Oct 2007 13:05:48 -0300, Heck, Bob <bob.heck@eds.com> wrote:
>
> > So, how does layout.tml know to use specific.tml to fill in the
> > <t:body/> tag?  Does it have to be injected somehow?  Where does it
> > get a reference? How is this done?
>
> <t:body> just renders whatever was put inside your <t:layout> tag. ;) The
> specific page uses the layout, not the inverse.
>
>
> --
> Thiago H. de Paula Figueiredo
> Desenvolvedor, Instrutor e Consultor de Tecnologia Eteg Tecnologia da
> Informação Ltda.
> http://www.eteg.com.br
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Reply | Threaded
Open this post in threaded view
|

Re: Templates and t:body

joshcanfield-2
In reply to this post by bobheck
Hi Bob,

Think of the element <t:layout> as a reference to your component, like
calling a method. The same goes for using <t:textfield> or any of the other
components, they just point to a component to run at that point of the page.
You can think of the contents of that element as an intrinsic parameter to
the component. The <t:body> element processes those contents, invoking any
components that might be contained. This allows you to choose where in your
layout html those contents are rendered.

A simpler, but related component might be one that rendered it's contents in
a box with a black border. You could create the box component like this:

Box.java (empty but currently required )
Box.tml
<div style="border:thin black solid"
    xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
 <t:body/>
</div>

Now within your other pages/components you could use it like this:

<t:box>This is in a box</t:box>


I hope this helps...
Josh


On 10/18/07, Heck, Bob <[hidden email]> wrote:

>
> <t:layout> and <t:body> are in two separate files.  How does that work?
>
>
>
> -----Original Message-----
> From: Thiago H de Paula Figueiredo [mailto:[hidden email]]
> Sent: Thursday, October 18, 2007 12:17
> To: Tapestry users
> Subject: Re: Templates and t:body
>
> On Thu, 18 Oct 2007 13:05:48 -0300, Heck, Bob <[hidden email]> wrote:
>
> > So, how does layout.tml know to use specific.tml to fill in the
> > <t:body/> tag?  Does it have to be injected somehow?  Where does it
> > get a reference? How is this done?
>
> <t:body> just renders whatever was put inside your <t:layout> tag. ;) The
> specific page uses the layout, not the inverse.
>
>
> --
> Thiago H. de Paula Figueiredo
> Desenvolvedor, Instrutor e Consultor de Tecnologia Eteg Tecnologia da
> Informação Ltda.
> http://www.eteg.com.br
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>


--
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.
Reply | Threaded
Open this post in threaded view
|

Re: Templates and t:body

joshcanfield-2
In reply to this post by angelochen
Did you create the Header.java?

On 10/18/07, Angelo Chen <[hidden email]> wrote:

>
>
> Hi Jonathan,
>
> I tried your approach, but does not work, here is my steps:
>
> 1. create a Header.html in component directory, it has only one
> line:<h2>hi
> my heading</h2>
> 2. I use it in my start.html:
>
> <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
> <head>
>    <title>Start Page</title>
> </head>
> <body>
> <h1>Start Page</h1>
>    <t:Header />
> </body>
> </html>
>
> It complains:Unable to resolve component type 'Header' to a component
> class
> name.
>
> Anything I'm missing here? Thanks,
> A.C.
>
>
> Jonathan Barker wrote:
> >
> > Sorry, I only answered half of your question.
> >
> > Including your standard header into hello.tml would be something like:
> >
> > <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
> >     <head>
> >         <title>My Tapestry Application</title>
> >     </head>
> >     <body>
> >         <t:header />
> >         My Page Specific Content
> >     </body>
> > </html>
> >
> >
> >> -----Original Message-----
> >> From: Heck, Bob [mailto:[hidden email]]
> >> Sent: Thursday, October 18, 2007 12:27 PM
> >> To: Tapestry users
> >> Subject: RE: Templates and t:body
> >>
> >> Or, maybe I should just start at the top.
> >>
> >> I have a header that I want to display on every page.  That header html
> >> (tml) markup is stored in the file header.tml
> >>
> >> How do I include this in another file, say hello.tml?  What is the
> syntax
> >> and component usage?
> >>
> >>
> >>
> >> -----Original Message-----
> >> From: Thiago H de Paula Figueiredo [mailto:[hidden email]]
> >> Sent: Thursday, October 18, 2007 12:17
> >> To: Tapestry users
> >> Subject: Re: Templates and t:body
> >>
> >> On Thu, 18 Oct 2007 13:05:48 -0300, Heck, Bob <[hidden email]> wrote:
> >>
> >> > So, how does layout.tml know to use specific.tml to fill in the
> >> > <t:body/> tag?  Does it have to be injected somehow?  Where does it
> >> > get a reference? How is this done?
> >>
> >> <t:body> just renders whatever was put inside your <t:layout> tag. ;)
> The
> >> specific page uses the layout, not the inverse.
> >>
> >>
> >> --
> >> Thiago H. de Paula Figueiredo
> >> Desenvolvedor, Instrutor e Consultor de Tecnologia Eteg Tecnologia da
> >> Informação Ltda.
> >> http://www.eteg.com.br
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [hidden email]
> >> For additional commands, e-mail: [hidden email]
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [hidden email]
> >> For additional commands, e-mail: [hidden email]
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]
> > For additional commands, e-mail: [hidden email]
> >
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Templates-and-t%3Abody-tf4647900.html#a13279344
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>


--
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.
Reply | Threaded
Open this post in threaded view
|

RE: Templates and t:body

jonabarker
In reply to this post by angelochen

It worked for me.  Make sure you have created a Header class in your
components package.

My .java files are bare class declarations, so here are my .tml files:

Hello.tml

<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
<head><title>Some Title</title></head>
<body>
<t:header />
</body>
</html>

Header.tml

<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
<H1> test header</H1>
</html>

The resulting page source:

<html>
<head><link href="/assets/tapestry/default.css" rel="stylesheet"
type="text/css"><title>Some Title</title></head>
<body>
<html>
<H1> test header</H1>
</html>
</body>
</html>


It also works whether you use t:header or t:Header.



> -----Original Message-----
> From: Angelo Chen [mailto:[hidden email]]
> Sent: Thursday, October 18, 2007 1:19 PM
> To: [hidden email]
> Subject: RE: Templates and t:body
>
>
> Hi Jonathan,
>
> I tried your approach, but does not work, here is my steps:
>
> 1. create a Header.html in component directory, it has only one
> line:<h2>hi
> my heading</h2>
> 2. I use it in my start.html:
>
> <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
> <head>
>     <title>Start Page</title>
> </head>
> <body>
> <h1>Start Page</h1>
>     <t:Header />
> </body>
> </html>
>
> It complains:Unable to resolve component type 'Header' to a component
> class
> name.
>
> Anything I'm missing here? Thanks,
> A.C.
>
>
> Jonathan Barker wrote:
> >
> > Sorry, I only answered half of your question.
> >
> > Including your standard header into hello.tml would be something like:
> >
> > <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
> >     <head>
> >         <title>My Tapestry Application</title>
> >     </head>
> >     <body>
> >  <t:header />
> >         My Page Specific Content
> >     </body>
> > </html>
> >
> >
> >> -----Original Message-----
> >> From: Heck, Bob [mailto:[hidden email]]
> >> Sent: Thursday, October 18, 2007 12:27 PM
> >> To: Tapestry users
> >> Subject: RE: Templates and t:body
> >>
> >> Or, maybe I should just start at the top.
> >>
> >> I have a header that I want to display on every page.  That header html
> >> (tml) markup is stored in the file header.tml
> >>
> >> How do I include this in another file, say hello.tml?  What is the
> syntax
> >> and component usage?
> >>
> >>
> >>
> >> -----Original Message-----
> >> From: Thiago H de Paula Figueiredo [mailto:[hidden email]]
> >> Sent: Thursday, October 18, 2007 12:17
> >> To: Tapestry users
> >> Subject: Re: Templates and t:body
> >>
> >> On Thu, 18 Oct 2007 13:05:48 -0300, Heck, Bob <[hidden email]> wrote:
> >>
> >> > So, how does layout.tml know to use specific.tml to fill in the
> >> > <t:body/> tag?  Does it have to be injected somehow?  Where does it
> >> > get a reference? How is this done?
> >>
> >> <t:body> just renders whatever was put inside your <t:layout> tag. ;)
> The
> >> specific page uses the layout, not the inverse.
> >>
> >>
> >> --
> >> Thiago H. de Paula Figueiredo
> >> Desenvolvedor, Instrutor e Consultor de Tecnologia Eteg Tecnologia da
> >> Informação Ltda.
> >> http://www.eteg.com.br
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [hidden email]
> >> For additional commands, e-mail: [hidden email]
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [hidden email]
> >> For additional commands, e-mail: [hidden email]
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]
> > For additional commands, e-mail: [hidden email]
> >
> >
> >
>
> --
> View this message in context: http://www.nabble.com/Templates-and-
> t%3Abody-tf4647900.html#a13279344
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Templates and t:body

Nick Westgate
In reply to this post by bobheck
In Tapestry (all versions) when you use the word "include" to
describe something, you should be thinking about components.

Either the header goes in your Border/Layout component, or you
make a header component which gets rendered in a Border.

The documentation for Tapestry's special t:body element is here:
http://tapestry.apache.org/tapestry5/tapestry-core/guide/templates.html

Also, regarding your earlier confusion:

 > 1.  I thought a layout component should start with t:layout, someone
 > please clarify if the first block is actually a layout component.

Imagine you were writing a textfield component with its own template.
In the component's html/tml template, would you start with <t:textfield>?
No. That's almost like recursion: a Textfield starts with a Textfield?

In any template, <t:componentName> invokes the _use_ of componentName.

Cheers,
Nick.


Heck, Bob wrote:

> Or, maybe I should just start at the top.
>
> I have a header that I want to display on every page.  That header html (tml) markup is stored in the file header.tml
>
> How do I include this in another file, say hello.tml?  What is the syntax and component usage?
>
>
>
> -----Original Message-----
> From: Thiago H de Paula Figueiredo [mailto:[hidden email]]
> Sent: Thursday, October 18, 2007 12:17
> To: Tapestry users
> Subject: Re: Templates and t:body
>
> On Thu, 18 Oct 2007 13:05:48 -0300, Heck, Bob <[hidden email]> wrote:
>
>> So, how does layout.tml know to use specific.tml to fill in the
>> <t:body/> tag?  Does it have to be injected somehow?  Where does it
>> get a reference? How is this done?
>
> <t:body> just renders whatever was put inside your <t:layout> tag. ;) The specific page uses the layout, not the inverse.
>
>
> --
> Thiago H. de Paula Figueiredo
> Desenvolvedor, Instrutor e Consultor de Tecnologia Eteg Tecnologia da Informação Ltda.
> http://www.eteg.com.br
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

RE: Templates and t:body

bobheck
In reply to this post by joshcanfield-2
I created the Header.java and I am getting the same error:
Unable to resolve 'Header' to a component class name

Here is my Header.java

public class Header {

        public Header()
        {
               
        }
}

and my Header.tml

<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
<h1>This is a header</h1>
</html>



Just to make sure, I dug into my classes files that were deployed and the Header.class is there.  

Josh, what version of Tapestry are you using?  I am using 5.0.6-SNAPSHOT

Angelo, what version are you using?

Thanks in advance.
 

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Josh Canfield
Sent: Thursday, October 18, 2007 12:36
To: Tapestry users
Subject: Re: Templates and t:body

Did you create the Header.java?

On 10/18/07, Angelo Chen <[hidden email]> wrote:

>
>
> Hi Jonathan,
>
> I tried your approach, but does not work, here is my steps:
>
> 1. create a Header.html in component directory, it has only one
> line:<h2>hi my heading</h2> 2. I use it in my start.html:
>
> <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
> <head>
>    <title>Start Page</title>
> </head>
> <body>
> <h1>Start Page</h1>
>    <t:Header />
> </body>
> </html>
>
> It complains:Unable to resolve component type 'Header' to a component
> class name.
>
> Anything I'm missing here? Thanks,
> A.C.
>
>
> Jonathan Barker wrote:
> >
> > Sorry, I only answered half of your question.
> >
> > Including your standard header into hello.tml would be something like:
> >
> > <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
> >     <head>
> >         <title>My Tapestry Application</title>
> >     </head>
> >     <body>
> >         <t:header />
> >         My Page Specific Content
> >     </body>
> > </html>
> >
> >
> >> -----Original Message-----
> >> From: Heck, Bob [mailto:[hidden email]]
> >> Sent: Thursday, October 18, 2007 12:27 PM
> >> To: Tapestry users
> >> Subject: RE: Templates and t:body
> >>
> >> Or, maybe I should just start at the top.
> >>
> >> I have a header that I want to display on every page.  That header
> >> html
> >> (tml) markup is stored in the file header.tml
> >>
> >> How do I include this in another file, say hello.tml?  What is the
> syntax
> >> and component usage?
> >>
> >>
> >>
> >> -----Original Message-----
> >> From: Thiago H de Paula Figueiredo [mailto:[hidden email]]
> >> Sent: Thursday, October 18, 2007 12:17
> >> To: Tapestry users
> >> Subject: Re: Templates and t:body
> >>
> >> On Thu, 18 Oct 2007 13:05:48 -0300, Heck, Bob <[hidden email]> wrote:
> >>
> >> > So, how does layout.tml know to use specific.tml to fill in the
> >> > <t:body/> tag?  Does it have to be injected somehow?  Where does
> >> > it get a reference? How is this done?
> >>
> >> <t:body> just renders whatever was put inside your <t:layout> tag.
> >> ;)
> The
> >> specific page uses the layout, not the inverse.
> >>
> >>
> >> --
> >> Thiago H. de Paula Figueiredo
> >> Desenvolvedor, Instrutor e Consultor de Tecnologia Eteg Tecnologia
> >> da Informação Ltda.
> >> http://www.eteg.com.br
> >>
> >> -------------------------------------------------------------------
> >> -- To unsubscribe, e-mail: [hidden email]
> >> For additional commands, e-mail: [hidden email]
> >>
> >>
> >> -------------------------------------------------------------------
> >> -- To unsubscribe, e-mail: [hidden email]
> >> For additional commands, e-mail: [hidden email]
> >
> >
> > --------------------------------------------------------------------
> > - To unsubscribe, e-mail: [hidden email]
> > For additional commands, e-mail: [hidden email]
> >
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Templates-and-t%3Abody-tf4647900.html#a13279344
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>


--
--
TheDailyTube.com. Sign up and get the best new videos on the internet delivered fresh to your inbox.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Templates and t:body

Howard Lewis Ship
Tapestry mandates a certain organization to your classes.

If you page class is org.example.pages.MyPage then your component class
(here, Header) must be  org.example.components.Header.  The .pages. and
.components. part is very specific to Tapestry, hard-wired into the
framework.  Those are packages that Tapestry scans at startup to locate page
and component classes, and such classes must exist there (for Tapestry to
perform runtime code transformation and hot class reloading).

On 10/19/07, Heck, Bob <[hidden email]> wrote:

>
> I created the Header.java and I am getting the same error:
> Unable to resolve 'Header' to a component class name
>
> Here is my Header.java
>
> public class Header {
>
>         public Header()
>         {
>
>         }
> }
>
> and my Header.tml
>
> <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
> <h1>This is a header</h1>
> </html>
>
>
>
> Just to make sure, I dug into my classes files that were deployed and the
> Header.class is there.
>
> Josh, what version of Tapestry are you using?  I am using 5.0.6-SNAPSHOT
>
> Angelo, what version are you using?
>
> Thanks in advance.
>
>
> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]] On Behalf Of
> Josh Canfield
> Sent: Thursday, October 18, 2007 12:36
> To: Tapestry users
> Subject: Re: Templates and t:body
>
> Did you create the Header.java?
>
> On 10/18/07, Angelo Chen <[hidden email]> wrote:
> >
> >
> > Hi Jonathan,
> >
> > I tried your approach, but does not work, here is my steps:
> >
> > 1. create a Header.html in component directory, it has only one
> > line:<h2>hi my heading</h2> 2. I use it in my start.html:
> >
> > <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
> > <head>
> >    <title>Start Page</title>
> > </head>
> > <body>
> > <h1>Start Page</h1>
> >    <t:Header />
> > </body>
> > </html>
> >
> > It complains:Unable to resolve component type 'Header' to a component
> > class name.
> >
> > Anything I'm missing here? Thanks,
> > A.C.
> >
> >
> > Jonathan Barker wrote:
> > >
> > > Sorry, I only answered half of your question.
> > >
> > > Including your standard header into hello.tml would be something like:
> > >
> > > <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
> > >     <head>
> > >         <title>My Tapestry Application</title>
> > >     </head>
> > >     <body>
> > >         <t:header />
> > >         My Page Specific Content
> > >     </body>
> > > </html>
> > >
> > >
> > >> -----Original Message-----
> > >> From: Heck, Bob [mailto:[hidden email]]
> > >> Sent: Thursday, October 18, 2007 12:27 PM
> > >> To: Tapestry users
> > >> Subject: RE: Templates and t:body
> > >>
> > >> Or, maybe I should just start at the top.
> > >>
> > >> I have a header that I want to display on every page.  That header
> > >> html
> > >> (tml) markup is stored in the file header.tml
> > >>
> > >> How do I include this in another file, say hello.tml?  What is the
> > syntax
> > >> and component usage?
> > >>
> > >>
> > >>
> > >> -----Original Message-----
> > >> From: Thiago H de Paula Figueiredo [mailto:[hidden email]]
> > >> Sent: Thursday, October 18, 2007 12:17
> > >> To: Tapestry users
> > >> Subject: Re: Templates and t:body
> > >>
> > >> On Thu, 18 Oct 2007 13:05:48 -0300, Heck, Bob <[hidden email]>
> wrote:
> > >>
> > >> > So, how does layout.tml know to use specific.tml to fill in the
> > >> > <t:body/> tag?  Does it have to be injected somehow?  Where does
> > >> > it get a reference? How is this done?
> > >>
> > >> <t:body> just renders whatever was put inside your <t:layout> tag.
> > >> ;)
> > The
> > >> specific page uses the layout, not the inverse.
> > >>
> > >>
> > >> --
> > >> Thiago H. de Paula Figueiredo
> > >> Desenvolvedor, Instrutor e Consultor de Tecnologia Eteg Tecnologia
> > >> da Informação Ltda.
> > >> http://www.eteg.com.br
> > >>
> > >> -------------------------------------------------------------------
> > >> -- To unsubscribe, e-mail: [hidden email]
> > >> For additional commands, e-mail: [hidden email]
> > >>
> > >>
> > >> -------------------------------------------------------------------
> > >> -- To unsubscribe, e-mail: [hidden email]
> > >> For additional commands, e-mail: [hidden email]
> > >
> > >
> > > --------------------------------------------------------------------
> > > - To unsubscribe, e-mail: [hidden email]
> > > For additional commands, e-mail: [hidden email]
> > >
> > >
> > >
> >
> > --
> > View this message in context:
> > http://www.nabble.com/Templates-and-t%3Abody-tf4647900.html#a13279344
> > Sent from the Tapestry - User mailing list archive at Nabble.com.
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]
> > For additional commands, e-mail: [hidden email]
> >
> >
>
>
> --
> --
> TheDailyTube.com. Sign up and get the best new videos on the internet
> delivered fresh to your inbox.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>


--
Howard M. Lewis Ship
Partner and Senior Architect at Feature50

Creator Apache Tapestry and Apache HiveMind
Reply | Threaded
Open this post in threaded view
|

RE: Templates and t:body

bobheck
Ok, still have a problem.  No error, just no header rendered.

-------------------------------------------
Here is my Header.java file:

package try.tapestry.components;

public class Header {

        public Header()
        {
               
        }
}

--------------------------------------------
Here is my Header.tml file:

<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
<body>
<h1>This is a header</h1>
</body>
</html>

--------------------------------------------
Here is my Start.tml

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
<title>Hello World Title</title>
</head>
<body>
<t:Header />
Hello world. Start.
</body>
</html>

-----------------------------------------------
Here is my Start.java

package try.tapestry.pages;

public class Start {

        public Start ()
        {
               
        }
}

-------------------------------------------------
Here is the output when rendered (no header was inserted, just ignored.  No errors.):

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><link href="/assets/tapestry/default.css" rel="stylesheet" type="text/css"><meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type"><title>Hello World Title</title></head><body>

Hello world. Start.
</body></html>
-------------------------------------------------


Any help is appreciated.  I MUST be missing something so simple.

Bob


-----Original Message-----
From: Howard Lewis Ship [mailto:[hidden email]]
Sent: Friday, October 19, 2007 18:20
To: Tapestry users
Subject: Re: Templates and t:body

Tapestry mandates a certain organization to your classes.

If you page class is org.example.pages.MyPage then your component class (here, Header) must be  org.example.components.Header.  The .pages. and .components. part is very specific to Tapestry, hard-wired into the framework.  Those are packages that Tapestry scans at startup to locate page and component classes, and such classes must exist there (for Tapestry to perform runtime code transformation and hot class reloading).

On 10/19/07, Heck, Bob <[hidden email]> wrote:

>
> I created the Header.java and I am getting the same error:
> Unable to resolve 'Header' to a component class name
>
> Here is my Header.java
>
> public class Header {
>
>         public Header()
>         {
>
>         }
> }
>
> and my Header.tml
>
> <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
> <h1>This is a header</h1>
> </html>
>
>
>
> Just to make sure, I dug into my classes files that were deployed and
> the Header.class is there.
>
> Josh, what version of Tapestry are you using?  I am using
> 5.0.6-SNAPSHOT
>
> Angelo, what version are you using?
>
> Thanks in advance.
>
>
> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]] On Behalf
> Of Josh Canfield
> Sent: Thursday, October 18, 2007 12:36
> To: Tapestry users
> Subject: Re: Templates and t:body
>
> Did you create the Header.java?
>
> On 10/18/07, Angelo Chen <[hidden email]> wrote:
> >
> >
> > Hi Jonathan,
> >
> > I tried your approach, but does not work, here is my steps:
> >
> > 1. create a Header.html in component directory, it has only one
> > line:<h2>hi my heading</h2> 2. I use it in my start.html:
> >
> > <html
> > xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
> > <head>
> >    <title>Start Page</title>
> > </head>
> > <body>
> > <h1>Start Page</h1>
> >    <t:Header />
> > </body>
> > </html>
> >
> > It complains:Unable to resolve component type 'Header' to a
> > component class name.
> >
> > Anything I'm missing here? Thanks,
> > A.C.
> >
> >
> > Jonathan Barker wrote:
> > >
> > > Sorry, I only answered half of your question.
> > >
> > > Including your standard header into hello.tml would be something like:
> > >
> > > <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
> > >     <head>
> > >         <title>My Tapestry Application</title>
> > >     </head>
> > >     <body>
> > >         <t:header />
> > >         My Page Specific Content
> > >     </body>
> > > </html>
> > >
> > >
> > >> -----Original Message-----
> > >> From: Heck, Bob [mailto:[hidden email]]
> > >> Sent: Thursday, October 18, 2007 12:27 PM
> > >> To: Tapestry users
> > >> Subject: RE: Templates and t:body
> > >>
> > >> Or, maybe I should just start at the top.
> > >>
> > >> I have a header that I want to display on every page.  That
> > >> header html
> > >> (tml) markup is stored in the file header.tml
> > >>
> > >> How do I include this in another file, say hello.tml?  What is
> > >> the
> > syntax
> > >> and component usage?
> > >>
> > >>
> > >>
> > >> -----Original Message-----
> > >> From: Thiago H de Paula Figueiredo [mailto:[hidden email]]
> > >> Sent: Thursday, October 18, 2007 12:17
> > >> To: Tapestry users
> > >> Subject: Re: Templates and t:body
> > >>
> > >> On Thu, 18 Oct 2007 13:05:48 -0300, Heck, Bob <[hidden email]>
> wrote:
> > >>
> > >> > So, how does layout.tml know to use specific.tml to fill in the
> > >> > <t:body/> tag?  Does it have to be injected somehow?  Where
> > >> > does it get a reference? How is this done?
> > >>
> > >> <t:body> just renders whatever was put inside your <t:layout> tag.
> > >> ;)
> > The
> > >> specific page uses the layout, not the inverse.
> > >>
> > >>
> > >> --
> > >> Thiago H. de Paula Figueiredo
> > >> Desenvolvedor, Instrutor e Consultor de Tecnologia Eteg
> > >> Tecnologia da Informação Ltda.
> > >> http://www.eteg.com.br
> > >>
> > >> -----------------------------------------------------------------
> > >> --
> > >> -- To unsubscribe, e-mail: [hidden email]
> > >> For additional commands, e-mail: [hidden email]
> > >>
> > >>
> > >> -----------------------------------------------------------------
> > >> --
> > >> -- To unsubscribe, e-mail: [hidden email]
> > >> For additional commands, e-mail: [hidden email]
> > >
> > >
> > > ------------------------------------------------------------------
> > > --
> > > - To unsubscribe, e-mail: [hidden email]
> > > For additional commands, e-mail: [hidden email]
> > >
> > >
> > >
> >
> > --
> > View this message in context:
> > http://www.nabble.com/Templates-and-t%3Abody-tf4647900.html#a1327934
> > 4 Sent from the Tapestry - User mailing list archive at Nabble.com.
> >
> >
> > --------------------------------------------------------------------
> > - To unsubscribe, e-mail: [hidden email]
> > For additional commands, e-mail: [hidden email]
> >
> >
>
>
> --
> --
> TheDailyTube.com. Sign up and get the best new videos on the internet
> delivered fresh to your inbox.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>


--
Howard M. Lewis Ship
Partner and Senior Architect at Feature50

Creator Apache Tapestry and Apache HiveMind

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

RE: Templates and t:body

bobheck
Ok Found the answer as to why this was not working.

This may be trivial to seasoned users, but a hard catch for a newbie.

For components, such as the Header we have been talking about, the .java file AND the .tml file need to both reside in the components package.  I had been putting the .tml file in the webroot and the .java for the component in components.   Moved the .tml to components package and it works now.

Bob

 

-----Original Message-----
From: Heck, Bob [mailto:[hidden email]]
Sent: Friday, October 19, 2007 19:33
To: Tapestry users
Subject: RE: Templates and t:body

Ok, still have a problem.  No error, just no header rendered.

-------------------------------------------
Here is my Header.java file:

package try.tapestry.components;

public class Header {

        public Header()
        {
               
        }
}

--------------------------------------------
Here is my Header.tml file:

<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
<body>
<h1>This is a header</h1>
</body>
</html>

--------------------------------------------
Here is my Start.tml

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> <title>Hello World Title</title> </head> <body> <t:Header /> Hello world. Start.
</body>
</html>

-----------------------------------------------
Here is my Start.java

package try.tapestry.pages;

public class Start {

        public Start ()
        {
               
        }
}

-------------------------------------------------
Here is the output when rendered (no header was inserted, just ignored.  No errors.):

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><link href="/assets/tapestry/default.css" rel="stylesheet" type="text/css"><meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type"><title>Hello World Title</title></head><body>

Hello world. Start.
</body></html>
-------------------------------------------------


Any help is appreciated.  I MUST be missing something so simple.

Bob


-----Original Message-----
From: Howard Lewis Ship [mailto:[hidden email]]
Sent: Friday, October 19, 2007 18:20
To: Tapestry users
Subject: Re: Templates and t:body

Tapestry mandates a certain organization to your classes.

If you page class is org.example.pages.MyPage then your component class (here, Header) must be  org.example.components.Header.  The .pages. and .components. part is very specific to Tapestry, hard-wired into the framework.  Those are packages that Tapestry scans at startup to locate page and component classes, and such classes must exist there (for Tapestry to perform runtime code transformation and hot class reloading).

On 10/19/07, Heck, Bob <[hidden email]> wrote:

>
> I created the Header.java and I am getting the same error:
> Unable to resolve 'Header' to a component class name
>
> Here is my Header.java
>
> public class Header {
>
>         public Header()
>         {
>
>         }
> }
>
> and my Header.tml
>
> <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
> <h1>This is a header</h1>
> </html>
>
>
>
> Just to make sure, I dug into my classes files that were deployed and
> the Header.class is there.
>
> Josh, what version of Tapestry are you using?  I am using
> 5.0.6-SNAPSHOT
>
> Angelo, what version are you using?
>
> Thanks in advance.
>
>
> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]] On Behalf
> Of Josh Canfield
> Sent: Thursday, October 18, 2007 12:36
> To: Tapestry users
> Subject: Re: Templates and t:body
>
> Did you create the Header.java?
>
> On 10/18/07, Angelo Chen <[hidden email]> wrote:
> >
> >
> > Hi Jonathan,
> >
> > I tried your approach, but does not work, here is my steps:
> >
> > 1. create a Header.html in component directory, it has only one
> > line:<h2>hi my heading</h2> 2. I use it in my start.html:
> >
> > <html
> > xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
> > <head>
> >    <title>Start Page</title>
> > </head>
> > <body>
> > <h1>Start Page</h1>
> >    <t:Header />
> > </body>
> > </html>
> >
> > It complains:Unable to resolve component type 'Header' to a
> > component class name.
> >
> > Anything I'm missing here? Thanks,
> > A.C.
> >
> >
> > Jonathan Barker wrote:
> > >
> > > Sorry, I only answered half of your question.
> > >
> > > Including your standard header into hello.tml would be something like:
> > >
> > > <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
> > >     <head>
> > >         <title>My Tapestry Application</title>
> > >     </head>
> > >     <body>
> > >         <t:header />
> > >         My Page Specific Content
> > >     </body>
> > > </html>
> > >
> > >
> > >> -----Original Message-----
> > >> From: Heck, Bob [mailto:[hidden email]]
> > >> Sent: Thursday, October 18, 2007 12:27 PM
> > >> To: Tapestry users
> > >> Subject: RE: Templates and t:body
> > >>
> > >> Or, maybe I should just start at the top.
> > >>
> > >> I have a header that I want to display on every page.  That
> > >> header html
> > >> (tml) markup is stored in the file header.tml
> > >>
> > >> How do I include this in another file, say hello.tml?  What is
> > >> the
> > syntax
> > >> and component usage?
> > >>
> > >>
> > >>
> > >> -----Original Message-----
> > >> From: Thiago H de Paula Figueiredo [mailto:[hidden email]]
> > >> Sent: Thursday, October 18, 2007 12:17
> > >> To: Tapestry users
> > >> Subject: Re: Templates and t:body
> > >>
> > >> On Thu, 18 Oct 2007 13:05:48 -0300, Heck, Bob <[hidden email]>
> wrote:
> > >>
> > >> > So, how does layout.tml know to use specific.tml to fill in the
> > >> > <t:body/> tag?  Does it have to be injected somehow?  Where
> > >> > does it get a reference? How is this done?
> > >>
> > >> <t:body> just renders whatever was put inside your <t:layout> tag.
> > >> ;)
> > The
> > >> specific page uses the layout, not the inverse.
> > >>
> > >>
> > >> --
> > >> Thiago H. de Paula Figueiredo
> > >> Desenvolvedor, Instrutor e Consultor de Tecnologia Eteg
> > >> Tecnologia da Informação Ltda.
> > >> http://www.eteg.com.br
> > >>
> > >> -----------------------------------------------------------------
> > >> --
> > >> -- To unsubscribe, e-mail: [hidden email]
> > >> For additional commands, e-mail: [hidden email]
> > >>
> > >>
> > >> -----------------------------------------------------------------
> > >> --
> > >> -- To unsubscribe, e-mail: [hidden email]
> > >> For additional commands, e-mail: [hidden email]
> > >
> > >
> > > ------------------------------------------------------------------
> > > --
> > > - To unsubscribe, e-mail: [hidden email]
> > > For additional commands, e-mail: [hidden email]
> > >
> > >
> > >
> >
> > --
> > View this message in context:
> > http://www.nabble.com/Templates-and-t%3Abody-tf4647900.html#a1327934
> > 4 Sent from the Tapestry - User mailing list archive at Nabble.com.
> >
> >
> > --------------------------------------------------------------------
> > - To unsubscribe, e-mail: [hidden email]
> > For additional commands, e-mail: [hidden email]
> >
> >
>
>
> --
> --
> TheDailyTube.com. Sign up and get the best new videos on the internet
> delivered fresh to your inbox.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>


--
Howard M. Lewis Ship
Partner and Senior Architect at Feature50

Creator Apache Tapestry and Apache HiveMind

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]