Home arrow Apache arrow Creating Your First Tapestry Project

Creating Your First Tapestry Project

In the previous article, we began moving from theory to practice by preparing our work place and setting up our system. In this article, we actually get our hands dirty (at least figuratively) by building our first Tapestry project.

  1. Creating Your First Tapestry Project
  2. Adding Tapestry
  3. Deployment descriptor
  4. The First Tapestry Page
By: Alexander Kolesnikov
Rating: starstarstarstarstar / 35
April 17, 2007

print this article



From now on, I am going to use NetBeans. If you prefer to use Eclipse, the steps will be similar, but the details might differ. The good news is that when we come to writing code, the differences in IDEs will not matter that much.

Fire up your NetBeans. In the menu, choose File > New Project..., then select Web Application like so:

Press Next, and in the next dialog enter the name for your new project, say, FirstTapestry. I would advise you to store all your projects in a separate folder; in this case I named it NBProjects. Make sure that the bundled Tomcat is selected for the server. Also note that Context Path reflects the name of your application -- this is what will be appended to the hosting server's domain name to form your application's context.

Have a look at the screenshot to make sure everything is set properly:

Press Next. The next dialog allows you to choose a framework to use in your application, but only two choices are available for now, JavaServer Faces and Struts. We are not going to use either of them. In the future, the Tapestry module for NetBeans will hopefully be completed and then we might be able to have our application preconfigured for Tapestry while we're right in the process of setting up a new project. For now, simply press Finish, as we are going to create the necessary configuration by hand.

Let's have a look at the structure of the new project created for us by NetBeans:

You can see that the structure of a NetBeans Web project does not directly reflect the standard structure of a Java Web application. It has its own logic, more convenient for development. However, when at some stage we shall want to deploy and test our application, it will be packaged for us exactly as required by standards.

Now, let's have a look at what we have here.

The Web Pages folder contains the future Web application. You can see the familiar standard subfolders here, META-INF and WEB-INF. If we need to, we can add some other folders, say, for images and styles. There is also a basic default JSP page, index.jsp. We shall leave it so far, but it won't be needed in the future.

The Configuration Files folder contains quite conveniently everything we might want to configure. Most importantly, you see the deployment descriptor, web.xml - we are going to work with it in one of the next sections.

Have a look at the MANIFEST.MF file. It is very simple, and we are not going to add anything to it. It will simply be put into the META-INF directory at the packaging stage.

Also, have a look at the context.xml file. This one is Tomcat specific and simply tells the server what to add to its domain name in order to form our application's context - remember, we specified this when setting up the project. Here are the contents of the context.xml:

<?xml version="1.0" encoding="UTF-8"?>

<Context path="/FirstTapestry"/>

Very simple, and nothing to change so far, so let's go on.

The next important folder for us is the one called Source Packages. This is where we shall place the source files for page classes and any other classes that might be needed for our application.

Finally, there is a folder named Libraries. This is where we shall put JAR files containing Tapestry and everything it depends on.

As for the remaining folders -- Server Resources, Test Packages and Test Libraries -- we shall not need them for our first simple application. However, we are going to leave them just because one day you might want to extend this basic application and create on its basis something more impressive.

>>> More Apache Articles          >>> More By Alexander Kolesnikov

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort


- Apache Unveils Cassandra 1.2
- Apache on ARM Chips? Dell and Calxeda Help M...
- The Down Side of Open Source Software
- VMware Unveils Serengeti for Apache Hadoop
- SAP Takes Steps to Improve Hadoop Integration
- Looking to Hone Apache Hadoop Skills?
- How to Install Joomla on WAMPP
- Working with XAMPP and Wordpress
- GUI Available for Apache Camel
- Reduce Server Load for Apache and PHP Websit...
- Creating a VAMP (Vista, Apache, MySQL, PHP) ...
- Putting Apache in Jail
- Containing Intrusions in Apache
- Server Limits for Apache Security
- Setting Permissions in Apache

Developer Shed Affiliates


Dev Shed Tutorial Topics: