[RSS]

Using the Tapestry Framework With NetBeans

In this tutorial we will learn how to use the Tapestry Framework with NetBeans.

The Tapestry Framework

Tapestry is an open-source framework for creating dynamic, robust, highly scalable web applications in Java. Tapestry complements and builds upon the standard Java Servlet API, and so it works in any servlet container or application server. Tapestry divides a web application into a set of pages, each constructed from components. This provides a consistent structure, allowing the Tapestry framework to assume responsibility for key concerns such as URL construction and dispatch, persistent state storage on the client or on the server, user input validation, localization/internationalization, and exception reporting. Developing Tapestry applications involves creating HTML templates using plain HTML, and combining the templates with small amounts of Java code using (optional) XML descriptor files. In Tapestry, you create your application in terms of objects, and the methods and properties of those objects -- and specifically not in terms of URLs and query parameters. Tapestry brings true object oriented development to Java web applications.

Tapestry is specifically designed to make creating new components very easy, as this is a routine approach when building applications. Tapestry is architected to scale from tiny applications all the way up to massive applications consisting of hundreds of individual pages, developed by large, diverse teams. Tapestry easily integrates with any kind of back-end, including J2EE, HiveMind and Spring .

Preface

This has been tested with NetBeans 5.5.1and Apache Tomcat 5.5.17 using JDK 1.5 on Windows and Linux. NetBeans is supposed to be installed using the bundled Tomcat 5.5.17 container or higher.

Softwares Required:

1.Modules to support Tapestry on NetBeans

2. NetBeans IDE 5.5.1 with bundled Tomcat (as the Tapestry Supprt Module for NetBeans IDE currently does not support NetBeans 6.0)

3. Java Standard Development Kit (JDK™) version 1.5

Getting Started with Tapestry Framework on NetBeans

First of all we will install all the software needed and ensure that the project is set up correctly.

1. Goto Tools -> Update Center and choose "Install manually downloaded modules" so that we can give install the modules previously downloaded.

Update Center

Installing manually downloaded modules
Click Next.

2. Click on the Add button to browse all the three modules one by one.

Adding module files

3. At the next step you are asked to view certificates and finalize install. Include all the three modules by checking the radio button to their left.

4. Choose File > New Project. Under Categories, select Web. Under Projects, select Web Application. Click Next.

5. In the Name panel, type Demo and change the Project Location to any directory on your computer.

6. Here you have to choose from the available frameworks, choose " Typestry 4.0". At the bottom you can see a message asking you to create a library and add some jar files to it. Do remember the name of the library asked to be created as we will be using it at a later stage. Click the "Download Bundle" link, shown in the screenshot above, the Tapestry Support Module for NetBeans IDE page will open in the IDE's default browser. From there, you can download all the JARs in one go.

7. Now finish the wizard and create the required library by going at Tools -> Library Manager.

8. Click "New Library" at the bottom left of the wizard and enter Library Name same as that asked in step 6. Once the Library is created add those jar files to it which we downloaded at step 6.

9. Repeat step 4 and you will see that now the IDE is compatible with Tapestry Framework. Leave values as default and click Finish.

10. The IDE creates the Demo project. The project contains all of your sources and project metadata. You can view its logical structure in the Projects window (Ctrl-1). Make sure that all the JAR files are available, when you expand the Libraries node. If they are not there, manually add them by right-clicking the Libraries node, choosing Add JAR/Folder, and browsing to the JARs in your filesystem. Before going further, your Libraries node should contain the following JAR files:

11. Without any programming whatsoever, you can already run your application. Right-click the project node and choose Run Project. The server starts, if it is not running already, and the application is deployed. The IDE's default browser starts up, showing you the following overview page:

Now change the content according to your wish :)

Building the Project

You can build the project using F11 and run by F6.

Attachments

001.JPG Info on 001.JPG 17207 bytes
002.JPG Info on 002.JPG 29970 bytes
003.JPG Info on 003.JPG 57971 bytes
004.jpg Info on 004.jpg 72789 bytes
005.jpg Info on 005.jpg 50095 bytes
006.jpg Info on 006.jpg 54404 bytes
007.JPG Info on 007.JPG 61203 bytes
008.bmp Info on 008.bmp 173746 bytes
009.JPG Info on 009.JPG 56218 bytes
010.JPG Info on 010.JPG 51080 bytes
011.JPG Info on 011.JPG 39221 bytes
012.JPG Info on 012.JPG 63073 bytes
013.JPG Info on 013.JPG 52249 bytes
014.JPG Info on 014.JPG 34364 bytes