Apache Tapestry Quick Start - Apache Tapestry

How to create a project using Apache tapestry?

After installing Tapestry, a new initial project can be created using Maven as shown below

Response is shown below

After Maven builds all the operations, select archetype for creating Tapestry 5 QuickStart project as shown below

How to Choose archetype ?

  • https://tapestry.apache.org → org.apache.tapestry:quickstart (Tapestry 5 Quickstart Project)
  • https://tapestry.apache.org → org.apache.tapestry:tapestry-archetype (Tapestry 4.1.6 Archetype)

Choose a number or apply filter (format: [groupId:]artifactId, case sensitive contains): : 1

You will get a response as shown below

Extract the QuickStart version number as shown below

Here, QuickStart project takes the version for the option 5, “5.4.1” and Tapestry archetype asks following information

  • 5.1 groupId − Define value for property 'groupId': : com.example
  • 5.2 artifactId − Define value for property 'artifactId': : Myapp
  • 5.3 version − Define value for property 'version': 1.0-SNAPSHOT: :
  • 5.4 package name − Define value for property 'package': com.example: : com.example.Myapp

Next, screen asks confirmation for below

How to Confirm properties configuration ?

  • groupId − com.example
  • artifactId − Myapp
  • version − 1.0-SNAPSHOT
  • package − com.example.Myapp

User should verify all the properties and confirm the changes using the option shown below

Screen as shown below should be displayed

Now Tapestry Quick Start project has been built successfully. Move to the location of the newly created Myapp directory with the following command and start coding.

How to Run Application?

To run the skeleton project, use below shown command.

A screen as shown below appears

For now a basic Quick Start project has been created in Tapestry. To view the running application in the web browser, just type below shown URL in the address bar and press enter

https://localhost:8080/myapp

Here, myapp is the name of the application and 8080 is the default port of the application in development mode.

How to Use Eclipse?

This chapter gives a detailed description on creating a skeleton application in Eclipse IDE.

Maven archetype can be used to create skeleton application. To configure a new application, below shown steps should be followed.

Step 1: Open Eclipse IDE

Open your Eclipse and choose File → New → Project… → option as shown in below screenshot.

open eclipse

Now, select Maven → Maven project option.

Note − Maven has to be configured to create a project.

After selecting Maven project, click Next and again click the Next button.

maven

After that a screen will be displayed where user should select the configure option. Once it is configured, below screen will be displayed.

configure

Step 2: Catalog Configuration

After the first step is done, click on Add Remote Catalog. Then add the changes as shown in below screenshot.

remote catelog

Now, Apache Tapestry Catalog is added. Then, select the filter option org.apache.tapestry quickstart 5.4.1 as shown below.

added

Then click Next and the below screen will appear.

group id

Step 3: Configure GroupId, ArtifactId, version and package

Add below shown changes to the Tapestry Catalog configuration.

configure

Then click Finish button, now first skeleton application has been created. Initially project creation may take time as Maven downloads many JAR dependencies for Maven, Jetty and Tapestry. After Maven finishes, a new directory called MyFirstApplication is shown in the Package Explorer view.

Step 4: Run the application using Jetty server

Maven can be used to run Jetty directly. Right-click on MyFirstApplication project in the Package Explorer view and select Run As → Maven Build…

Below shown screen will appear.

jetty

In the configuration dialog box, type goals option as “jetty:run” and click Run button.

goals

Once Jetty is initialized, below screen will be shown in the console.

jetty

Step 5: Run in the web browser

Type below shown URL to run the application in a web browser

https://loclhost:8080/MyFirstApplication

run web

Step 6: Stop the Jetty server

To stop Jetty server, click the red square icon in the console as shown below.

stop server

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Apache Tapestry Topics