FeaturesPluginsDocs & SupportCommunityPartners

Adding Support For A Web Framework

This document provides a general description of how to add support for a web framework in NetBeans IDE. The steps provided show how you can add support by installing a web framework plugin into the IDE using the Plugin Manager. After you install the plugin you will be able to select the framework in the New Project wizard when you create a web project. The new web project is then created containing the necessary infrastructure specific to the chosen framework.

The easiest way to add support for a particular web framework is by installing a NetBeans plugin using the Plugin Manager. NetBeans plugins are available for many web frameworks, and the number of plugins available is continuously growing. Many plugins can be downloaded directly from the NetBeans Plugin Portal.

Note: Support for JavaServer Faces and Struts frameworks is included in the IDE by default. Support for the Spring Framework is now integrated into NetBeans 6.1.

Some of the currently available plugins include the following:

Framework Plugin Location Tutorial
Google Web Toolkit https://gwt4nb.dev.java.net/ Introduction to the Google Web Toolkit Framework
jMaki https://ajax.dev.java.net/servlets/ProjectDocumentList Introduction to the jMaki Web Framework
Wicket https://nbwicketsupport.dev.java.net/ Introduction to the Wicket Web Framework
Facelets https://facelets.dev.java.net Introduction to Facelets
Tapestry https://nbtapestrysupport.dev.java.net/ Introduction to the Tapestry Web Framework

If there is no plugin available for your framework, you can still add support by creating a library for that framework in the IDE and then adding that library to your project. For an example, see Using Hibernate with the Java Persistence API.

Contents

Content on this page applies to NetBeans IDE 6.0 and 6.1

To follow this tutorial, you need the following software and resources.

Software or Resource Version Required
NetBeans IDE Web and Java EE installation
version 6.1 or version 6.0
Java Developer Kit (JDK) version 6 or version 5

Notes:

  • The Web and Java EE installation enables you to optionally install the Apache Tomcat 6.0 servlet container, and the GlassFish V2 application server. Depending on the framework you plan to use, you must install one of these to work through this tutorial.
  • You must also have an Internet connection to download necessary plugins and/or access them via the IDE's Plugin Manager.

Installing a Framework Support Plugin

You can add support for a specific framework by installing the appropriate framework support plugin into the IDE. To do so, you can either download and install the plugin manually, or, if the plugin is maintained by an update center, you can register the update center with the IDE's Plugin Manager, then download and install directly through the Plugin Manager. To install a framework support plugin, do either of the following:

Installing Manually

  1. Download a framework support plugin directly from an external resource. For example, follow a link to the plugin location of your preferred framework from the NetBeans Plugin Portal or the table above, and download the advertised NetBeans IDE framework support plugin(s). NetBeans plugins can be identified by their .nbm extension, e.g., the jMaki framework support plugin is the listed org-netbeans-modules-sun-jmaki.nbm file.
  2. From the IDE's main menu, choose Tools > Plugins to open the Plugin Manager. Select the Downloaded tab, then click the Add Plugins button.
  3. In the Add Plugins dialog, navigate to the location where the plugin was saved on your computer, and click Open. A description of the plugin displays in the Plugin Manager. If you selected jMaki, you see the following:

    jMaki framework support plugin displayed in the Plugin Manager prior to installation
  4. Click install to open the NetBeans IDE Installer, then click Next and accept the license agreement. If you receive a validation warning, click Continue to install the plugin. A validation warning occurs if you attempt to install a plugin that has not been signed. Restart the IDE to allow changes to take effect.

Installing via an Update Center

If the framework support plugin is maintained by an update center, you should consider installing the update center into the IDE. This enables you to then install the framework support plugin directly through the Plugin Manager. Also, the Plugin Manager logs any updates made to plugins maintained by update centers, providing you with a simple and effective means of keeping installed plugins up-to-date.

Taking jMaki as an example, you can download and install the Ajax Update Center for NetBeans module. The Ajax Update Center includes the jMaki framework support plugin, and a plugin for Phobos, which is a light-weight, scripting-friendly programming model that can run on the Java platform. Do the following:

  1. Download the Ajax Update Center for NetBeans module.
  2. In the IDE, choose Tools > Plugins to open the Plugin Manager. Select the Downloaded tab, then click the Add Plugins button.
  3. In the Add Plugins dialog, navigate to the location where the plugin was saved on your computer, and click Open. The plugin displays in the Plugin Manager.
  4. Click Install to open the NetBeans IDE Installer, then click Next and accept the license agreement. If you receive a validation warning, click Continue to install the plugin. A validation warning occurs if you attempt to install a plugin that has not been signed. The IDE successfully installs the update center.

Note: In order to verify that the Ajax Update Center has been added to the list of update centers operating in the Plugin Manager, select the Settings tab in the Plugin Manager. From the Settings tab you can view all installed update centers and specify configuration settings, such as how frequently update centers check for updates:


Now that you have the Ajax Update Center installed, you can use it to download and install the plugin fro jMaki Framework support. Using an Internet connection, the Ajax Update Center automatically checks the status of plugins associated with it. Because the jMaki Framework Support plugin is included, it becomes available for download and installation in the Plugin Manager. To install the jMaki Framework Support plugin, you simply need to select it from the Available Plugins tab in the Plugin Manager:

  1. Choose Tools > Plugins to open the Plugin Manager.
  2. Make sure the Available Plugins tab is selected, then select the Install option for the jMaki Ajax Support plugin:

    jMaki Ajax Support plugin listed under Available Plugins
  3. Click install to open the NetBeans IDE Installer, then click Next and accept the license agreement. If you receive a validation warning, click Continue to install the plugin. A validation warning occurs if you attempt to install a plugin that has not been signed. Restart the IDE to allow changes to take effect.

Working with Framework Support in the IDE

Framework support in the IDE is generally specific to the framework you are working with. For example, jMaki UI support allows you to drag and drop web components from the IDE's Palette directly into the page you are working on in the Source Editor while Spring ...

You can add framework support to a web application either through the New Project wizard at the time you create the application, or you can integrate support into an existing application recursively. The following demonstrates both methods, using jMaki as an example:

Adding Framework Support to a New Project

  1. Choose File > New Project (Ctrl-Shift-N) from the main menu. The New Project wizard opens. Select Web under Categories, then under Projects, select Web Application. Click Next.
  2. Type jMakiTestApp for the Project Name and specify a location for the project.
  3. Select GlassFish as server for the Server drop-down box, then click Next.
  4. In the Frameworks panel, choose jMaki Ajax Framework. The jMaki Ajax Framework option was added when you installed the framework support plugin. The support plugin also enables you to specify a CSS layout to use in your web application:

    jMaki Ajax Support listed in Frameworks panel of the New Project wizard
  5. Select the Standard CSS Style layout and click Finish.

The IDE creates the web application using the jMaki application structure, which includes jMaki-specific artifacts in the resources folder. Also note that framework libraries are added to the new project's classpath. Examine the logical structure of the web application in the Projects window:

    logical structure of jMaki web application displayed in Projects window

Note: For more information on the jMaki application structure, see Basic jMaki Application Structure.

Adding Framework Support to an Existing Project

  1. In the Projects window, right-click the web application project's node and choose Properties. The Project Properties window displays.
  2. Under Categories, select Frameworks. The right panel displays a Used Frameworks text area, which is empty if the application does not use a framework.
  3. Click the Add button, then select the framework you want to work with and click OK:

    Add framework support to an existing application in the Project Properties window
  4. Depending on the chosen framework, specify any further framework-specific configuration settings presented in the Project Properties window (i.e., jMaki support allows you to specify a CSS layout, whereas Spring Web MVC support enables you to set the dispatcher name and mapping). Click OK to confirm your selection and close the Project Properties window. Framework-specific artifacts and libraries are added to your project, which you can examine in the Projects window.

See Also

This document described how to add support for a web framework in NetBeans IDE. It demonstrated how to install framework support plugins both manually as well as through an update center in the IDE's Plugin Manager. It also showed how to add an IDE-supported framework to both a new web application project and an existing project.

This tutorial focused on using the jMaki Ajax framework. If you would like to explore the other features offered by this framework, see jMaki Developer Resources for further documentation. Also, the Sun Web Developer Pack provides tutorials and sample projects to help you learn more about developing with the jMaki framework, and other Ajax-oriented technologies.

For more information about using other web frameworks in NetBeans IDE, see the following resources:

Bookmark this page

del.icio.us furl simpy slashdot technorati digg
Companion
Projects:
MySQL Database Server   Open JDK: an Open SourceJDK   GlassFish Community: an Open Source Application Server    Mobile & Embedded Community    Open Solaris   java.net - The Source for Java Technology Collaboration   Open ESB - The Open Enterprise Service Bus Powered by