You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Josh Kamau <jo...@gmail.com> on 2010/11/06 11:36:40 UTC
Creating custom component
Hi guys;
I am trying to compose a page but assembling various sections e.g the menu
bar, the header and the footer as separate components.
I have my Index page which "inherits" from the main layout. Now i have made
the menu bar as follows
menubar.tml
<html t:type="menubar" xmlns:t="
http://tapestry.apache.org/schema/tapestry_5_1_0.xsd">
<body>
<h2>I am a menubar</h2>
</body>
</html>
Menubar.java
package com.josh.tcontacts.components;
public class MenuBar {
}
index page tml
<html t:type="layout" xmlns:t="
http://tapestry.apache.org/schema/tapestry_5_1_0.xsd">
<head>
</head>
<body>
<h1>Hello world . Its now ${today}</h1>
<t:menubar/>
</body>
</html>
index page java
package com.josh.tcontacts.pages;
import java.util.Date;
import org.apache.tapestry5.annotations.Property;
public class Index {
private Date today ;
public Date getToday() {
return new Date();
}
public void setToday(Date today) {
this.today = today;
}
}
How do i add the menubar to the index page? i have done the above but its
not working.
regards
Re: Creating custom component
Posted by Guerin Laurent <lg...@sopragroup.com>.
In addition to the Tapestry documentation and if you use Eclipse, you should have a look at :
http://wiki.apache.org/tapestry/Tapestry5JSPEditorEclipse
This will provide you code completion on components in your tml files, with documentation on component itself and also on the component parameters.
Le 6 nov. 2010 à 15:49, "Josh Kamau" <jo...@gmail.com> a écrit :
> Thanks Sven,
>
> This is exactly what i am talking about. How am i supposed to know that
> something like <t:content> exists? what what else is out there? and what
> else am i using the wrong way? you get my point.? I think the Hotel-booking
> application should be made complicated enough to use as many tapestry
> features as possible. I have gone through it and it doesnt have what i am
> looking for.
>
> Thanks for your response. I will keep trying.
>
> Regards.
>
> On Sat, Nov 6, 2010 at 10:37 AM, Sven Homburg <ho...@googlemail.com>wrote:
>
>> you can also use this template code:
>>
>>
>> <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd">
>> <body>
>> <t:content>
>> <h2>I am a menubar</h2>
>> </t:content>
>> </body>
>> </html>
>>
>> the <t:content> let tapestry know, that all code between <t:content>
>> and </t:content>
>> is relevant for your component and strips all away outside this tag.
>>
>> it is the better way, if you use design tools like dreamweaver or others
>>
>> with regards
>> Sven Homburg
>> Founder of the Chenille Kit Project
>> http://chenillekit.codehaus.org
>>
>>
>>
>>
>>
>> 2010/11/6 Josh Kamau <jo...@gmail.com>:
>>> thanks Thiago,
>>>
>>> I have fixed the component as follows :
>>>
>>> <t:menubar xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd
>> ">
>>> <h2>I am a menubar</h2>
>>> </t:menubar>
>>>
>>> now how do i add it to my page? i have added it by putting <t:menubar/>
>> or
>>> <div t:type="menubar"/> and its not appearing.
>>>
>>> this is my index page.
>>>
>>> <html t:type="layout" xmlns:t="
>>> http://tapestry.apache.org/schema/tapestry_5_1_0.xsd">
>>>
>>> <head>
>>>
>>> </head>
>>>
>>> <body>
>>> <h1>Hello world . Its now ${today}</h1>
>>> <t:menubar/>
>>> </body>
>>> </html>
>>>
>>> On Sat, Nov 6, 2010 at 6:41 AM, Thiago H. de Paula Figueiredo <
>>> thiagohp@gmail.com> wrote:
>>>
>>>> On Sat, 06 Nov 2010 08:36:40 -0200, Josh Kamau <jo...@gmail.com>
>>>> wrote:
>>>>
>>>> Hi guys;
>>>>>
>>>>
>>>> Hi!
>>>>
>>>> Don't use the <html> tag in components' templates (unless you're
>> creating a
>>>> Layout-style one).
>>>> And don't forget that the name of the template is case-sensitive, so
>>>> MenuBar.java -> MenuBar.tml.
>>>>
>>>> --
>>>> Thiago H. de Paula Figueiredo
>>>> Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
>>>> and instructor
>>>> Owner, Ars Machina Tecnologia da Informação Ltda.
>>>> http://www.arsmachina.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
>>
>>
Re: Creating custom component
Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Sat, 06 Nov 2010 12:48:38 -0200, Josh Kamau <jo...@gmail.com>
wrote:
> This is exactly what i am talking about. How am i supposed to know that
> something like <t:content> exists?
The documentation needs improvement, no doubt, but this information is no
hard to find: it's under 'component templates' in the current
documentation.
--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Creating custom component
Posted by Christophe Cordenier <ch...@gmail.com>.
Hi !
2010/11/6 Josh Kamau <jo...@gmail.com>
> Thanks Sven,
>
> This is exactly what i am talking about. How am i supposed to know that
> something like <t:content> exists? what what else is out there? and what
> else am i using the wrong way? you get my point.? I think the Hotel-booking
> application should be made complicated enough to use as many tapestry
> features as possible.
alright, simply tell us ! We are eager of feedback, followers and
contributors !
> I have gone through it and it doesnt have what i am
> looking for.
>
> Thanks for your response. I will keep trying.
>
> Regards.
>
> On Sat, Nov 6, 2010 at 10:37 AM, Sven Homburg <homburgs@googlemail.com
> >wrote:
>
> > you can also use this template code:
> >
> >
> > <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd">
> > <body>
> > <t:content>
> > <h2>I am a menubar</h2>
> > </t:content>
> > </body>
> > </html>
> >
> > the <t:content> let tapestry know, that all code between <t:content>
> > and </t:content>
> > is relevant for your component and strips all away outside this tag.
> >
> > it is the better way, if you use design tools like dreamweaver or others
> >
> > with regards
> > Sven Homburg
> > Founder of the Chenille Kit Project
> > http://chenillekit.codehaus.org
> >
> >
> >
> >
> >
> > 2010/11/6 Josh Kamau <jo...@gmail.com>:
> > > thanks Thiago,
> > >
> > > I have fixed the component as follows :
> > >
> > > <t:menubar xmlns:t="
> http://tapestry.apache.org/schema/tapestry_5_1_0.xsd
> > ">
> > > <h2>I am a menubar</h2>
> > > </t:menubar>
> > >
> > > now how do i add it to my page? i have added it by putting <t:menubar/>
> > or
> > > <div t:type="menubar"/> and its not appearing.
> > >
> > > this is my index page.
> > >
> > > <html t:type="layout" xmlns:t="
> > > http://tapestry.apache.org/schema/tapestry_5_1_0.xsd">
> > >
> > > <head>
> > >
> > > </head>
> > >
> > > <body>
> > > <h1>Hello world . Its now ${today}</h1>
> > > <t:menubar/>
> > > </body>
> > > </html>
> > >
> > > On Sat, Nov 6, 2010 at 6:41 AM, Thiago H. de Paula Figueiredo <
> > > thiagohp@gmail.com> wrote:
> > >
> > >> On Sat, 06 Nov 2010 08:36:40 -0200, Josh Kamau <joshnet2030@gmail.com
> >
> > >> wrote:
> > >>
> > >> Hi guys;
> > >>>
> > >>
> > >> Hi!
> > >>
> > >> Don't use the <html> tag in components' templates (unless you're
> > creating a
> > >> Layout-style one).
> > >> And don't forget that the name of the template is case-sensitive, so
> > >> MenuBar.java -> MenuBar.tml.
> > >>
> > >> --
> > >> Thiago H. de Paula Figueiredo
> > >> Independent Java, Apache Tapestry 5 and Hibernate consultant,
> developer,
> > >> and instructor
> > >> Owner, Ars Machina Tecnologia da Informação Ltda.
> > >> http://www.arsmachina.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
> >
> >
>
--
Regards,
Christophe Cordenier.
Committer on Apache Tapestry 5
Co-creator of wooki @wookicentral.com
Re: Creating custom component
Posted by Josh Kamau <jo...@gmail.com>.
Thanks Sven,
This is exactly what i am talking about. How am i supposed to know that
something like <t:content> exists? what what else is out there? and what
else am i using the wrong way? you get my point.? I think the Hotel-booking
application should be made complicated enough to use as many tapestry
features as possible. I have gone through it and it doesnt have what i am
looking for.
Thanks for your response. I will keep trying.
Regards.
On Sat, Nov 6, 2010 at 10:37 AM, Sven Homburg <ho...@googlemail.com>wrote:
> you can also use this template code:
>
>
> <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd">
> <body>
> <t:content>
> <h2>I am a menubar</h2>
> </t:content>
> </body>
> </html>
>
> the <t:content> let tapestry know, that all code between <t:content>
> and </t:content>
> is relevant for your component and strips all away outside this tag.
>
> it is the better way, if you use design tools like dreamweaver or others
>
> with regards
> Sven Homburg
> Founder of the Chenille Kit Project
> http://chenillekit.codehaus.org
>
>
>
>
>
> 2010/11/6 Josh Kamau <jo...@gmail.com>:
> > thanks Thiago,
> >
> > I have fixed the component as follows :
> >
> > <t:menubar xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd
> ">
> > <h2>I am a menubar</h2>
> > </t:menubar>
> >
> > now how do i add it to my page? i have added it by putting <t:menubar/>
> or
> > <div t:type="menubar"/> and its not appearing.
> >
> > this is my index page.
> >
> > <html t:type="layout" xmlns:t="
> > http://tapestry.apache.org/schema/tapestry_5_1_0.xsd">
> >
> > <head>
> >
> > </head>
> >
> > <body>
> > <h1>Hello world . Its now ${today}</h1>
> > <t:menubar/>
> > </body>
> > </html>
> >
> > On Sat, Nov 6, 2010 at 6:41 AM, Thiago H. de Paula Figueiredo <
> > thiagohp@gmail.com> wrote:
> >
> >> On Sat, 06 Nov 2010 08:36:40 -0200, Josh Kamau <jo...@gmail.com>
> >> wrote:
> >>
> >> Hi guys;
> >>>
> >>
> >> Hi!
> >>
> >> Don't use the <html> tag in components' templates (unless you're
> creating a
> >> Layout-style one).
> >> And don't forget that the name of the template is case-sensitive, so
> >> MenuBar.java -> MenuBar.tml.
> >>
> >> --
> >> Thiago H. de Paula Figueiredo
> >> Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
> >> and instructor
> >> Owner, Ars Machina Tecnologia da Informação Ltda.
> >> http://www.arsmachina.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
>
>
Re: Creating custom component
Posted by Sven Homburg <ho...@googlemail.com>.
you can also use this template code:
<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd">
<body>
<t:content>
<h2>I am a menubar</h2>
</t:content>
</body>
</html>
the <t:content> let tapestry know, that all code between <t:content>
and </t:content>
is relevant for your component and strips all away outside this tag.
it is the better way, if you use design tools like dreamweaver or others
with regards
Sven Homburg
Founder of the Chenille Kit Project
http://chenillekit.codehaus.org
2010/11/6 Josh Kamau <jo...@gmail.com>:
> thanks Thiago,
>
> I have fixed the component as follows :
>
> <t:menubar xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd">
> <h2>I am a menubar</h2>
> </t:menubar>
>
> now how do i add it to my page? i have added it by putting <t:menubar/> or
> <div t:type="menubar"/> and its not appearing.
>
> this is my index page.
>
> <html t:type="layout" xmlns:t="
> http://tapestry.apache.org/schema/tapestry_5_1_0.xsd">
>
> <head>
>
> </head>
>
> <body>
> <h1>Hello world . Its now ${today}</h1>
> <t:menubar/>
> </body>
> </html>
>
> On Sat, Nov 6, 2010 at 6:41 AM, Thiago H. de Paula Figueiredo <
> thiagohp@gmail.com> wrote:
>
>> On Sat, 06 Nov 2010 08:36:40 -0200, Josh Kamau <jo...@gmail.com>
>> wrote:
>>
>> Hi guys;
>>>
>>
>> Hi!
>>
>> Don't use the <html> tag in components' templates (unless you're creating a
>> Layout-style one).
>> And don't forget that the name of the template is case-sensitive, so
>> MenuBar.java -> MenuBar.tml.
>>
>> --
>> Thiago H. de Paula Figueiredo
>> Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
>> and instructor
>> Owner, Ars Machina Tecnologia da Informação Ltda.
>> http://www.arsmachina.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
Re: Creating custom component
Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Sat, 06 Nov 2010 08:47:03 -0200, Josh Kamau <jo...@gmail.com>
wrote:
> <t:menubar
> xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd">
> <h2>I am a menubar</h2>
> </t:menubar>
You're trying to use the component in it itself. The root element should
be <div>.
> now how do i add it to my page? i have added it by putting <t:menubar/>
> or <div t:type="menubar"/> and its not appearing.
> this is my index page.
> <html t:type="layout" xmlns:t="
> http://tapestry.apache.org/schema/tapestry_5_1_0.xsd">
>
> <head>
>
> </head>
>
> <body>
> <h1>Hello world . Its now ${today}</h1>
> <t:menubar/>
> </body>
> </html>
Please post your Layout class and template.
--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Creating custom component
Posted by Josh Kamau <jo...@gmail.com>.
thanks Thiago,
I have fixed the component as follows :
<t:menubar xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd">
<h2>I am a menubar</h2>
</t:menubar>
now how do i add it to my page? i have added it by putting <t:menubar/> or
<div t:type="menubar"/> and its not appearing.
this is my index page.
<html t:type="layout" xmlns:t="
http://tapestry.apache.org/schema/tapestry_5_1_0.xsd">
<head>
</head>
<body>
<h1>Hello world . Its now ${today}</h1>
<t:menubar/>
</body>
</html>
On Sat, Nov 6, 2010 at 6:41 AM, Thiago H. de Paula Figueiredo <
thiagohp@gmail.com> wrote:
> On Sat, 06 Nov 2010 08:36:40 -0200, Josh Kamau <jo...@gmail.com>
> wrote:
>
> Hi guys;
>>
>
> Hi!
>
> Don't use the <html> tag in components' templates (unless you're creating a
> Layout-style one).
> And don't forget that the name of the template is case-sensitive, so
> MenuBar.java -> MenuBar.tml.
>
> --
> Thiago H. de Paula Figueiredo
> Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
> and instructor
> Owner, Ars Machina Tecnologia da Informação Ltda.
> http://www.arsmachina.com.br
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
Re: Creating custom component
Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Sat, 06 Nov 2010 08:36:40 -0200, Josh Kamau <jo...@gmail.com>
wrote:
> Hi guys;
Hi!
Don't use the <html> tag in components' templates (unless you're creating
a Layout-style one).
And don't forget that the name of the template is case-sensitive, so
MenuBar.java -> MenuBar.tml.
--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org