You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 12 Next »

Introduction

WebWork comes with a utility called WebFlow. WebFlow is used to generate graphical diagrams representing the flow of your web application. It does this by parsing your configuration files, action classes, and view (JSP, Velocity, and FreeMarker) files. An example of a typical output of WebFlow is provided (for the full size, click here):

Additional information can be found in the JavaDocs:

Error formatting macro: snippet: java.lang.NullPointerException

Understanding the Output

There are several key things to notice when looking at the output from WebFlow:

  • Boxes: those shaded red indicate an action; those shaded green indicate a view file (JSP, etc).
  • Links: arrows colored green imply that no new HTTP request is being made; black arrows indicate a new HTTP request.
  • Link labels: labels may sometimes contain additional useful information. For example, a label of href means that the link behavior is that of a hyper-text reference. The complete label behaviors are provided:
    • href - a view file references an action by name (typically ending with the extension ".action")
    • action - a view file makes a call to the Action Tag
    • form - a view file is linked to an action using the Form Tag
    • redirect - an action is redirecting to another view or action
    • ! notation - a link to an action overrides the method to invoke

Requirements

Setting up

WebFlow is built in to WebWork, so if you're up and running with WebWork, you don't need to do anything additional java packages. However, WebFlow does require the "dot" package by GraphViz.

You'll need to download the latest version of GraphViz and make sure that the dot executable (dot.exe in Windows) is in your command path. In Windows the GraphViz installer typically automatically adds dot.exe to your path. However, you may need to do this by hand depending on your system configuration.

Usage

You can use WebFlow with the following command:

java -cp ... -jar webwork.jar
     -config CONFIG_DIR 
     -views VIEWS_DIRS 
     -output OUTPUT 
     [-ns NAMESPACE]

Where:

Error formatting macro: snippet: java.lang.NullPointerException

You must supply the correct classpath when invoking the WebFlow tool. Specifically, the XWork, WebWork, and their dependencies must be included in the classpath. Futhermore, you must also include your action class files referenced in xwork.xml. Without the proper class path entries, WebFlow will not function properly.

Once you have run WebFlow, check the directory specified in the "output" argument (OUTPUT). In there you will find two files: out.dot and out.gif. You may immediately open up out.gif and view the web application flow. However, you may also wish to either run the out.dot file through a different GraphVis layout engine (neato, twopi, etc), so the original dot file is provided as well. You may also wish to edit the dot file before rendering the final flow diagram.

Automatic Execution

Some advanced users may wish to execute WebFlow from within their application – this could be required if you are developing an application that supports WebWork plugin capabilities. This can easily be done. See the JavaDocs for more info:

Error formatting macro: snippet: java.lang.NullPointerException

The command line version of WebFlow does exactly this (except for overriding the Writer):

Error formatting macro: snippet: java.lang.NullPointerException
  • No labels