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

Compare with Current View Page History

« Previous Version 18 Next »

See it live !

You can play with Tapestry via our live demonstration applications. To start you can have a look at the Hotel Booking that has been developed by contributors and committers. The whole source code is available at github so you can download and play with it.

Create your first Tapestry project

The easiest way to get started 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.

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

mvn -DarchetypeVersion=5.2.4 -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.

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.

For more information on this, try the Tapestry Tutorial which goes into more detail about setting up your project, as well as loading it into Eclipse ... then continues on to teach you more about Tapestry.

Exploring the test 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 test 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

More

Learn more about Tapestry Philosophy and then checkout our full Documentation page on which you will find a lot of resources written by committers and contributors.

Obtain Help

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

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