JBoss.orgCommunity Documentation

Chapter 3. Editors

3.1. Web.xml Editor
3.2. Graphical Editor for Struts Configuration Files
3.2.1. Diagram View
3.2.2. Tree View
3.2.3. Source View
3.3. Graphical Editor for Tiles Files
3.3.1. Create New Tiles File
3.3.2. Tree View
3.3.3. Diagram View
3.3.4. Source
3.4. Graphical Editor for Struts Validation Files

This chapter will cover the graphical editors provided for editing specific Struts files such as Struts Configuration files, Tiles files, Struts Validation files and web.xml.

The web.xml file inside the WEB-INF folder is a deployment descriptor file for a Web Application. It describes the servlets, other components and deployment properties that make up your application.

JBoss Tools adds the web.xml file to a Struts project automatically and provides a special editor through which the file can be edited. See the Visual Web Tools guide that gives a descriptive information on the web.xml editor.

First, let's dwell on the Struts Configuration file editor.

This editor provides three views of the struts-config.xml file: Diagram, Tree and Source. The views can be selected using the tabs at the bottom of the editor. Any changes made in one view are immediately visible when you switch to any other view.

Now, we'll consider each of these three views in more detail.

The Tree view represents the different elements of the Struts application that are organized into functional categories on the left-hand side and a form for editing the properties of currently selected items on the right-hand side.


You can right-click on any node in the category tree to perform a number of operations through a context menu. For instance, by right-clicking on the action-mappings category node, you can add new actions to the application.


Let's consider the tree on the left more closely.

  • Under the data-sources node you can create a Data Source object that will be configured and made available as a servlet context attribute.

  • The form-beans node is meant for creating a set of form bean descriptors for this module. Every element under this node is a JavaBean that implements the org.apache.struts.action.ActionForm class. Use the Properties editor on the right to adjust the properties specific to each form-bean.

  • The global-exceptions node is intended for registering handlers for the exceptions that might be thrown by an Action object.

  • Use the global-forwards node to add, edit or delete a global forwards that represent ActionForward objects available to all Action objects as a return value.

  • The controller node allows you to configure the controller properties.

  • Under the resources node you can add, delete, or edit message resources.

  • Under the plug-ins node you can define a Struts plug-in. Right-click the node, select Create Plug-in and specify the plug-in Id and ClassName by pointing to the Java class which implements the org.apache.struts.action.PlugIn interface.

Here, you'll know how to make use of the special graphical editor for Tiles configuration files.

The editor has three main views: Tree, Diagram and Source. The views can be selected via the tabs at the bottom of the editor. Any changes made in one view are immediately visible when you switch to any other view.

Before we consider each view of the editor, let's look at the way of creating new Tiles files.

JBoss Tools comes with a visual validation editor that provides full support for the development of Struts applications. To open the editor double-click on the validation file, or create a new one if it doesn't exist.

To create a new validation file, right click any folder in Project Explorer and select FileNewOther... from the context menu and then select JBoss Tools WebStrutsValidation File.


The validation editor works with five modes: Formsets, Validators, Constants and standard Tree and Source that you can easily switch between using tabs at the bottom of the editor.

The Formsets view shows forms and their elements on the left side and the dialogue for defining their validation rules on the right side.


The Constants view let you set constant values for your validation rules.


The validation file can also be viewed in a Tree view.


At any point you have full control over the source by switching to the Source view. Any editing in this view will immediately be available in other views of the editor.


You can also open your own custom or Struts-standard validation-rules.xml file.

The Validators view shows the validation rules for a selected validator. You can of course add your own rules.


Here are the validation rules shown in the Source mode.