You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by mjparme <mj...@west.com> on 2009/01/16 22:01:57 UTC

Pages vs Components

In the last couple of days I have been working with Tapestry. I have read
Tutorial #1 and all the User Guides articles found here:
http://tapestry.apache.org/tapestry5/

I think I understand enough to get going at this point; however, one main
point I still don't quite understand (and seems like it is probably
something I should understand) is the difference between a Page and a
Component. I understand what pages are and have done some simple things over
the last couple of days but I don't understand when I would use a Component
and what they are for. Are they somewhat like a tag in a tag library?

BTW, I really like what I am seeing with Tapestry, vastly better than the
XML hell that is Struts. However, since it is a vast departure from most web
frameworks there is a pretty big learning curve. Seems worth it so far
though.
-- 
View this message in context: http://www.nabble.com/Pages-vs-Components-tp21508386p21508386.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: Pages vs Components

Posted by Onno Scheffers <on...@piraya.nl>.
>
> I don't understand when I would use a Component and what they are for.



Typically a web-application is built from a number of pages. And each page
is different.

Many elements on the pages will be the same or similar though. For those
elements it is usually wise to create a separate component and then use it
on all pages that should show that element.

This way you have a single block of code to test and when you need to make
changes you can do it in a single place and all pages that use that
component will be updated at once.

in that regard it is a little bit like a taglib, but better and much, much
easier to create yourself.


regards,

Onno

Re: Pages vs Components

Posted by Howard Lewis Ship <hl...@gmail.com>.
On Fri, Jan 16, 2009 at 1:42 PM, Christian Edward Gruber
<ch...@gmail.com> wrote:
> In some ways, a Page is just a Component that has no parent.

A page is a top level component.  Technically, the page component is
actually the root component of the actual page (true pages
are a concept internal to Tapestry) but it all works out the same in
the end.  Pages have a lifecycle (loaded, attached and detached).

>  I'm not 100%
> sure why they're separated, except that it's a historical artifact.

A bit more than that. Naming: page names can appear in URLs whereas
component types do not, instead component ids. Pages do have some
special responsibilities (activation, passivation, error handling).

>  Components (and pages being a special-case component) are a piece of java
> software that renders itself (usually as tags and possibly with a body,
> which may contain the renderings of other components.)  It's quite different
> than tag-libs.  Taglibs get turned into generated code that executes with
> other JSP code.  Components don't generate code, they are live objects with
> life-cycles that respond to events, just like a swing or Mac-OS Cocoa
> component.  JSP's code gets turned into a very very long execute() method on
> a servlet, so there's lots of entanglement.  There was a good article on
> this in the t5 docs, but I can't remember which one.
>
> Christian.
>
> On 16-Jan-09, at 16:01 , mjparme wrote:
>

>



-- 
Howard M. Lewis Ship

Creator Apache Tapestry and Apache HiveMind

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


Re: Pages vs Components

Posted by Christian Edward Gruber <ch...@gmail.com>.
In some ways, a Page is just a Component that has no parent.  I'm not  
100% sure why they're separated, except that it's a historical  
artifact.  Components (and pages being a special-case component) are a  
piece of java software that renders itself (usually as tags and  
possibly with a body, which may contain the renderings of other  
components.)  It's quite different than tag-libs.  Taglibs get turned  
into generated code that executes with other JSP code.  Components  
don't generate code, they are live objects with life-cycles that  
respond to events, just like a swing or Mac-OS Cocoa component.  JSP's  
code gets turned into a very very long execute() method on a servlet,  
so there's lots of entanglement.  There was a good article on this in  
the t5 docs, but I can't remember which one.

Christian.

On 16-Jan-09, at 16:01 , mjparme wrote:

>
> In the last couple of days I have been working with Tapestry. I have  
> read
> Tutorial #1 and all the User Guides articles found here:
> http://tapestry.apache.org/tapestry5/
>
> I think I understand enough to get going at this point; however, one  
> main
> point I still don't quite understand (and seems like it is probably
> something I should understand) is the difference between a Page and a
> Component. I understand what pages are and have done some simple  
> things over
> the last couple of days but I don't understand when I would use a  
> Component
> and what they are for. Are they somewhat like a tag in a tag library?
>
> BTW, I really like what I am seeing with Tapestry, vastly better  
> than the
> XML hell that is Struts. However, since it is a vast departure from  
> most web
> frameworks there is a pretty big learning curve. Seems worth it so far
> though.
> -- 
> View this message in context: http://www.nabble.com/Pages-vs-Components-tp21508386p21508386.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>

Christian Edward Gruber
christianedwardgruber@gmail.com




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