You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 29 Next »

Getting started with Tapestry is easy, and you have lots of ways to begin your adventure: watch a video, browse the source code of a working demo app, create a skeleton app using Maven, or step through the tutorial.

Watch a short video

For a fast-paced introduction, watch Mark W. Shead's 10 Minute Demo. This video shows how to set up a simple Tapestry application, complete with form validation, Hibernate-based persistence, and Ajax. The video provides a preview of the development speed and productivity that experienced Tapestry users enjoy.

Play with a working demo app

You can also play with Tapestry via our live demonstration applications. To start, have a look at the Hotel Booking Demo. The source code is provided so you can download and play with it.

Create your first Tapestry project

The easiest way to start a new app is to use Apache Maven to create your initial project; Maven can use an archetype (a kind of project template) to create a bare-bones Tapestry application for you.

Once you have Maven installed, execute the following command (copy and paste it as-is) 1 :

mvn -DarchetypeVersion=5.2.5 -Darchetype.interactive=false -DgroupId=com.example -DarchetypeArtifactId=quickstart -Dversion=1.0-SNAPSHOT -DarchetypeGroupId=org.apache.tapestry -Dpackage=com.example.newapp -DartifactId=newapp --batch-mode -DarchetypeRepository=http://tapestry.apache.org archetype:generate

Maven will (after performing a large number of one-time downloads) create a skeleton project ready to run. Because we specified an artifactId of "newapp", the project is created in the newapp directory. (Note: if you get "Unable to get resource" warnings at this stage, you may be behind a firewall which blocks outbound HTTP requests to Maven repositories.)

To run the skeleton application, change to the newapp directory and execute:

mvn jetty:run

After some more one-time downloads you can open your browser to http://localhost:8080 to see the application running.

You can also load the newly-created project it into any IDE and start coding. See the next section on where to find the different components of the application.

Exploring the skeleton project

A Tapestry application is composed of pages, each page consisting of one template file and one Java class.

Tapestry page templates have the .tml extension and are found in src/main/webapp. Templates are essential HTML with some special markup to link the template to the Java class and to reference ready-made components you can use to speed up your development.

Java classes are found in src/main/java/com/example/newapp/pages 2 and their name matches their template name (Index.tml -> Index.java).

In the skeleton project, most of the HTML is not found on the pages themselves but in a Layout component which acts as a global template for the whole site. Java classes for components live in src/main/java/com/example/newapp/components and component templates go in src/main/resources/com/example/newapp/components

What's next?

To deepen your understanding, step through the Tapestry Tutorial which goes into much more detail about setting up your project, as well as loading it into Eclipse ... then continues on to teach you more about Tapestry.

Be sure to read about the core Tapestry Principles, and browse the extensive User Guide.

Obtain Help

Tapestry has an active user mailing list on which you can find a lot of valuable support. You can subscribe by sending e-mail to users-subscribe@tapestry.apache.org or look for an answer in the archives. More Options...

Having trouble? Try our Frequently Asked Questions.


  1. If you prefer, just mvn archetype:generate -DarchetypeCatalog=http://tapestry.apache.org will work as well, and you will be prompted for the other details interactively.
  2. That is, in the com.example.newapp.pages package.

  • No labels