You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Nicolas Barrera <nb...@gmail.com> on 2011/07/07 16:54:35 UTC

Doubt including component in page

Hi,

I just wanted to run this test..., I got a tapestry archetype and added this
code in the components package:

Comp1.java:

package testComponent.components;
>
> public class Comp1 {
>
> }
>
>
Comp1.tml

<div xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd"
>     xmlns:p="tapestry:parameter">
>
>     <p>I 'm going crazy</p>
>
> </div>
>
>

after that, I modified Index.tml this way:


> <html t:type="layout" title="pruebaComponent Index" t:sidebarTitle="Current
> Time" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd"
> xmlns:p="tapestry:parameter">
>
>         <p>${message:greeting}</p>
>         <t:comp1 t:id="comp1"/>
> ...
>


The result when I refresh the Index page is that I can't see the phrase "I
'm going crazy"...

Am I misunderstanding something about compoments?

How should I include a component in my page?

cheers, and thanks in advance

Nicolás.-

Re: Doubt including component in page

Posted by Howard Lewis Ship <hl...@gmail.com>.
Tapestry gives you a bunch of options here and elsewhere. Perhaps
thats a failing, but it means you can adopt the practices that make
sense to you, in terms of naming and organization.

On Fri, Jul 8, 2011 at 7:51 AM, Thiago H. de Paula Figueiredo
<th...@gmail.com> wrote:
> On Fri, 08 Jul 2011 11:06:42 -0300, Nicolas Barrera <nb...@gmail.com>
> wrote:
>
>> Hi,
>
> Hi!
>
>> As it's not mandatory to have a @Component variable in Index.java I
>> started to think that including comp1 just as a tag in the tml may result in
>> a more difficult way of finding which pages
>> depend/include comp1.
>
> Good point. :)
>
>> Is there any recommendation you would give a tapestry newbie on how to
>> depend or include his own components into pages?
>
> Use the option you think it's the better one. I don't think there's any
> recommendation about it.
>
> You haven't asked, but I prefer to use <div t:type="If"> than <t:if>. :)
>
> --
> 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
>
>



-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Doubt including component in page

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Fri, 08 Jul 2011 11:06:42 -0300, Nicolas Barrera <nb...@gmail.com>  
wrote:

> Hi,

Hi!

> As it's not mandatory to have a @Component variable in Index.java I  
> started to think that including comp1 just as a tag in the tml may  
> result in a more difficult way of finding which pages
> depend/include comp1.

Good point. :)

> Is there any recommendation you would give a tapestry newbie on how to
> depend or include his own components into pages?

Use the option you think it's the better one. I don't think there's any  
recommendation about it.

You haven't asked, but I prefer to use <div t:type="If"> than <t:if>. :)

-- 
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: Doubt including component in page

Posted by Nicolas Barrera <nb...@gmail.com>.
Hi,

although the example worked out with the suggestions Thiago and Taha made...

I kept wondering around on this:

consider I include or use a certain component on my Index.tml

<html t:type="layout" title="pruebaComponent Index" t:sidebarTitle="Current
> Time" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd"
> xmlns:p="tapestry:parameter">
>
>     <p>${message:greeting}</p>
>
>     <t:comp1 t:id="comp1"/>
> ...
>

As it's not mandatory to have a @Component variable in Index.java I started
to think that including comp1 just as a tag in the tml may result in a more
difficult way of finding which pages
depend/include comp1.

Is there any recommendation you would give a tapestry newbie on how to
depend or include his own components into pages?


well, I hope I wasn't messy on my question
:)

cheers and thanks.


On Thu, Jul 7, 2011 at 12:55 PM, Nicolas Barrera <nb...@gmail.com> wrote:

> Thanks both, you just hit the note...,
>
> though I was pretty sure I had put it on the right place,... well... I
> didn't.
>
> Sorry for the buzz
>
> Nicolás.-
>
>
>
> On Thu, Jul 7, 2011 at 12:29 PM, Taha Hafeez <ta...@gmail.com>wrote:
>
>> Hi
>>
>> Where have you placed the component template, it should go in
>> src/main/resources/testComponent/components in case your application
>> package
>> is testComponent.
>>
>> regards
>> Taha
>>
>> On Thu, Jul 7, 2011 at 8:24 PM, Nicolas Barrera <nb...@gmail.com>
>> wrote:
>>
>> > Hi,
>> >
>> > I just wanted to run this test..., I got a tapestry archetype and added
>> > this
>> > code in the components package:
>> >
>> > Comp1.java:
>> >
>> > package testComponent.components;
>> > >
>> > > public class Comp1 {
>> > >
>> > > }
>> > >
>> > >
>> > Comp1.tml
>> >
>> > <div xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd"
>> > >     xmlns:p="tapestry:parameter">
>> > >
>> > >     <p>I 'm going crazy</p>
>> > >
>> > > </div>
>> > >
>> > >
>> >
>> > after that, I modified Index.tml this way:
>> >
>> >
>> > > <html t:type="layout" title="pruebaComponent Index"
>> > t:sidebarTitle="Current
>> > > Time" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd"
>> > > xmlns:p="tapestry:parameter">
>> > >
>> > >         <p>${message:greeting}</p>
>> > >         <t:comp1 t:id="comp1"/>
>> > > ...
>> > >
>> >
>> >
>> > The result when I refresh the Index page is that I can't see the phrase
>> "I
>> > 'm going crazy"...
>> >
>> > Am I misunderstanding something about compoments?
>> >
>> > How should I include a component in my page?
>> >
>> > cheers, and thanks in advance
>> >
>> > Nicolás.-
>> >
>>
>
>

Re: Doubt including component in page

Posted by Nicolas Barrera <nb...@gmail.com>.
Thanks both, you just hit the note...,

though I was pretty sure I had put it on the right place,... well... I
didn't.

Sorry for the buzz

Nicolás.-


On Thu, Jul 7, 2011 at 12:29 PM, Taha Hafeez <ta...@gmail.com>wrote:

> Hi
>
> Where have you placed the component template, it should go in
> src/main/resources/testComponent/components in case your application
> package
> is testComponent.
>
> regards
> Taha
>
> On Thu, Jul 7, 2011 at 8:24 PM, Nicolas Barrera <nb...@gmail.com>
> wrote:
>
> > Hi,
> >
> > I just wanted to run this test..., I got a tapestry archetype and added
> > this
> > code in the components package:
> >
> > Comp1.java:
> >
> > package testComponent.components;
> > >
> > > public class Comp1 {
> > >
> > > }
> > >
> > >
> > Comp1.tml
> >
> > <div xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd"
> > >     xmlns:p="tapestry:parameter">
> > >
> > >     <p>I 'm going crazy</p>
> > >
> > > </div>
> > >
> > >
> >
> > after that, I modified Index.tml this way:
> >
> >
> > > <html t:type="layout" title="pruebaComponent Index"
> > t:sidebarTitle="Current
> > > Time" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd"
> > > xmlns:p="tapestry:parameter">
> > >
> > >         <p>${message:greeting}</p>
> > >         <t:comp1 t:id="comp1"/>
> > > ...
> > >
> >
> >
> > The result when I refresh the Index page is that I can't see the phrase
> "I
> > 'm going crazy"...
> >
> > Am I misunderstanding something about compoments?
> >
> > How should I include a component in my page?
> >
> > cheers, and thanks in advance
> >
> > Nicolás.-
> >
>

Re: Doubt including component in page

Posted by Taha Hafeez <ta...@gmail.com>.
Hi

Where have you placed the component template, it should go in
src/main/resources/testComponent/components in case your application package
is testComponent.

regards
Taha

On Thu, Jul 7, 2011 at 8:24 PM, Nicolas Barrera <nb...@gmail.com> wrote:

> Hi,
>
> I just wanted to run this test..., I got a tapestry archetype and added
> this
> code in the components package:
>
> Comp1.java:
>
> package testComponent.components;
> >
> > public class Comp1 {
> >
> > }
> >
> >
> Comp1.tml
>
> <div xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd"
> >     xmlns:p="tapestry:parameter">
> >
> >     <p>I 'm going crazy</p>
> >
> > </div>
> >
> >
>
> after that, I modified Index.tml this way:
>
>
> > <html t:type="layout" title="pruebaComponent Index"
> t:sidebarTitle="Current
> > Time" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd"
> > xmlns:p="tapestry:parameter">
> >
> >         <p>${message:greeting}</p>
> >         <t:comp1 t:id="comp1"/>
> > ...
> >
>
>
> The result when I refresh the Index page is that I can't see the phrase "I
> 'm going crazy"...
>
> Am I misunderstanding something about compoments?
>
> How should I include a component in my page?
>
> cheers, and thanks in advance
>
> Nicolás.-
>

Re: Doubt including component in page

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Are you sure the component template is in the classpath in the same  
package as the component class?

On Thu, 07 Jul 2011 11:54:35 -0300, Nicolas Barrera <nb...@gmail.com>  
wrote:

> Hi,
>
> I just wanted to run this test..., I got a tapestry archetype and added  
> this
> code in the components package:
>
> Comp1.java:
>
> package testComponent.components;
>>
>> public class Comp1 {
>>
>> }
>>
>>
> Comp1.tml
>
> <div xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd"
>>     xmlns:p="tapestry:parameter">
>>
>>     <p>I 'm going crazy</p>
>>
>> </div>
>>
>>
>
> after that, I modified Index.tml this way:
>
>
>> <html t:type="layout" title="pruebaComponent Index"  
>> t:sidebarTitle="Current
>> Time" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd"
>> xmlns:p="tapestry:parameter">
>>
>>         <p>${message:greeting}</p>
>>         <t:comp1 t:id="comp1"/>
>> ...
>>
>
>
> The result when I refresh the Index page is that I can't see the phrase  
> "I
> 'm going crazy"...
>
> Am I misunderstanding something about compoments?
>
> How should I include a component in my page?
>
> cheers, and thanks in advance
>
> Nicolás.-


-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
Consultor, desenvolvedor e instrutor em Java, Tapestry e Hibernate
http://www.arsmachina.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org