Suppressing the Struts Page Flow Diagram

Written by Duncan Mills, Oracle Corporation
June 2004

Introduction

As part of the its support for the Oracle ADF runtime framework, JDeveloper 10g provides a visual page flow diagram to represent the Actions, Forwards and other implicit page flow defined in the struts-config.xml file. Developers are presented with a dual pane tabbed editor which gives them access to both the visual representation of the flow, and the source XML. This arrangement will give developers the flexibility to work in either a modeling or a code driven mode depending on which tab they have selected. However, some developers have expressed an interest in hiding the diagram view all together, either because they have very large configuration files that cannot be easily visualized in a diagram, or they are using Tiles based views that are not yet fully supported in the diagram view, or to simply remove the overhead of maintaining a diagram when they only ever want to work directly in the XML. This tip explains how to configure JDeveloper to manage the struts-config file in source only view.

The Struts Extensions

Like most parts of JDeveloper 10g, the Struts support is provided in the product in the form of an extension. There are in fact two nested extensions which make up the Struts design time support:

  • The core Struts Development Extension which provides the core handling of the XML including the console style editor and the structure pane and property inspector support.
  • The UML Modeler extension for Struts Development which provides the diagramming support.

Given this modularity it is possible to switch off the diagram support without effecting the rest of the Struts handing such as XML validation against the DTD and property inspector support.

The IDE Without Struts Diagram Support

Struts diagram support has to be enabled or disabled at the extension level, this means that when JDeveloper is running with the support disabled, all Struts configurations in the IDE will be shown without diagrams. However, JDeveloper allows you to create multiple IDE configurations that can be switched between, to provide the option of working with or without diagram support. If you create a struts-config.xml without a diagram, and later switch JDeveloper to enable diagram support, then a diagram file will be automatically generated for you when you next open the XML file.

Creating the Extension Configuration

  1. In JDeveloper, select the Tools > Preferences menu option
  2. In the preferences tree select Extension Manager
  3. Expand the Extensions > General > UML Modelers node in the right hand pane and uncheck the Struts Development option.


  4. The Profile combo list will clear and you can now press the Save As.. button and enter a new name for this extension profile, for instance NoStrutsDiagram.
  5. Finally select the new profile in the drop down list and press OK. You will have to restart JDeveloper for the new extension configuration to be used.
    You can switch back to one of the other profiles at any time, but will have to restart JDeveloper in order to pick the configuration up.

Developing Struts Without a Diagram

Running and Debugging

Without a Page flow diagram it is still possible to run selected Actions. Rather than selecting the action in the diagram and using the Run or Debug options off of the context menu, you can use the Structure Pane (Control+Shift+S) to select the required Action in the configuration and again choose run or debug from the context menu.

Setting the Default Run Target

To set an Action as the default run target for a configuration you will need to carry out two steps:

  1. In the project properties dialog, select Profiles > Runner in the option tree and set the Default Run Target for the project to struts-config.xml
  2. Then select the Action that you want to make the entry point to the application and set it's unknown attribute to true

Creating New Struts Elements

To create new Struts Objects such as Action Mappings you can of course manually add them to the XML, or you can use the context menu on the structure pane to add any object that you require, using the property inspector to define any attributes such as an Action's path. The console style editor is also available from the context menu via the Edit Struts Config... option as an alternate editing UI.

drmills v1.0

false ,,,,,,,,,,,,,,,