Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment:

Update formatting

Introduction

WebWork comes with a utility called SiteGraph. SiteGraph is used to generate SiteGraph generates graphical diagrams representing the flow of your web application. It does this

SiteGraph works by parsing your configuration files, action Action classes, and view files (JSP, Velocity, and FreeMarker) files. An example of a typical output of SiteGraph is provided (for the full size, click here):Image Removed, and displaying a visual map.

example.gif):Image Added

Info
titleJavadoc: (org.apache.struts.action2.sitegraph.SiteGraph)

Additional information can be found in the JavaDocs:

...

  • The JSP tags must use the "wwsaf" namespace.
    • In JSP: <ww<saf:xxx/>
    • In FreeMarker: <@ww<@saf.xxx/>
    • In Velocity: N/A
  • Use of the Form tag and Action tag must be linking directly to the action name (and optional namespace). This means that <ww<saf:form action="foo"/> is OK, but <ww<saf:form action="foo.action"/> is not.
  • All code is expected to be using the Alt Syntax.

Setting up

SiteGraph is built in to WebWorkthe framework, so if you're up and running with WebWork, you don't need to do anything additional java Java packages. However, SiteGraph 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 SiteGraph with the following command:

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

Where:

Wiki Markup
{snippet:id=sitegraph-usage|lang=none|url=webwork/src/java/com/opensymphony/webwork/sitegraph/sitegraph-usage.txt}
Warning

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

Once you have run SiteGraph, 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 SiteGraph 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:

...