Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3761268
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T10:35:58+00:00 2026-05-19T10:35:58+00:00

I have been using Tapestry’s built-in components, but now I’d like to try making

  • 0

I have been using Tapestry’s built-in components, but now I’d like to try making my own. Assuming this is possible, how is it done and is it generally expected that developers are going to be creating their own components in addition to what comes out of the box?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T10:35:59+00:00Added an answer on May 19, 2026 at 10:35 am

    Yes it is expected that developers will create their own components and it is pretty easy to do. There are quite a few projects out there where people are creating their libraries of components. If you want to see some examples take a look at:

    • http://chenillekit.org/demo/
    • http://code.google.com/p/corner/
    • http://code.google.com/p/myt5lib/
    • http://tapestry.formos.com/nightly/tapx/tapx-datefield/
    • http://code.google.com/p/tapestry5-treegrid/

    Components are much like pages. They usually have a .tml file and a .java file. The .java file goes in a src directory called components (src/main/java/com/examples/app/components) and the .tml file goes in the same place, but under resources (src/main/resources/com/examples/app/components)

    Here is an example of a component that renders as a Facebook share link that links to the EventInfo page and takes an Event object in order to construct the URL to share on Facebook.

    import java.io.UnsupportedEncodingException;
    import java.net.URLEncoder;
    
    import javax.persistence.Transient;
    
    import net.xeric.register.entities.Event;
    
    import org.apache.tapestry5.Link;
    import org.apache.tapestry5.annotations.Parameter;
    import org.apache.tapestry5.annotations.Property;
    import org.apache.tapestry5.ioc.annotations.Inject;
    import org.apache.tapestry5.services.PageRenderLinkSource;
    
    public class ShareEventOnFacebook {
    
        @Inject
        private PageRenderLinkSource linkSource;
    
        @Parameter(required=true)
        @Property
        private Event event;
    
    
        public String getFacebookShareURL() {
            Link link = linkSource.createPageRenderLinkWithContext("EventInfo", event);
            String linkURL = "";
            try {
                linkURL =  URLEncoder.encode(link.toAbsoluteURI(),"UTF-8");
            } catch (UnsupportedEncodingException e) {
    
                e.printStackTrace();
            }
            return linkURL;
        }
    
        public String getFacebookShareTitle() {
            String returnValue = "";
            try {
                returnValue = URLEncoder.encode(event.getDescription(), "UTF-8");
            } catch (Exception e) {
                e.printStackTrace();
            }
            return returnValue;       
        }
    
    }
    

    Pay particular attention to how the Event property is annotated to mark it as a required Parameter. This makes it a parameter of your component so you can call it from a template saying <t:shareeventonfacebook event="myEvent"/>

    And the corresponding template file:

    <t:container 
        xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd">
    
    
        <a href="http://www.facebook.com/sharer.php?u=${facebookShareURL}">
            Share on Facebook
        </a><br/>
    
    </t:container>
    

    You want to use the component in your page template you use:

    <t:shareeventonfacebook event="event"/>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been using data binding for several years with win forms, but now
I have been using something like this: int main(int argc, char *argv[]) { #ifdef
I have been using Castle MonoRail for the last two years, but in a
I have been using C# for a while now, and going back to C++
I have been using ASP.NET for years, but I can never remember when using
I have been using Ruby for a while now and I find, for bigger
I have been using IoC for a little while now and I am curious
I have been using the CSLA framework for couple of years now for windows
I have been using a stored procedure for more than 1.5 years. But I've
I have been using php for quite a sometime now and encounter three different

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.