Apache Struts 2 Documentation > Home > Guides > Core Developers Guide > Related Tools > SiteGraph |
SiteGraph generates graphical diagrams representing the flow of your web application.
SiteGraph works by parsing your configuration files, Action classes, and view files (JSP, Velocity, and FreeMarker), and displaying a visual map.
![]() | Javadoc: (org.apache.struts2.sitegraph.SiteGraph) |
Additional information can be found in the JavaDocs:
An error occurred: https://svn.apache.org/repos/asf/struts/struts2/trunk/core/src/main/java/org/apache/struts2/sitegraph/SiteGraph.java. The system administrator has been notified.There are several key things to notice when looking at the output from SiteGraph:
SiteGraph requires that your view files be structured in a very specific way. Because it has to read these files, only certain styles are supported. The requirements are:
SiteGraph is built in to the framework, so if you're up and running, you don't need to do anything additional 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.
You can use SiteGraph with the following command:
java -cp ... -jar struts2.jar sitegraph -config CONFIG_DIR -views VIEWS_DIRS -output OUTPUT [-ns NAMESPACE]
Where:
An error occurred: https://svn.apache.org/repos/asf/struts/struts2/trunk/core/src/main/resources/org/apache/struts/action2/sitegraph/sitegraph-usage.txt. The system administrator has been notified.![]() | You must supply the correct classpath when invoking the SiteGraph tool. Specifically, the XWork jar, Struts jar, and their dependencies must be included in the classpath. Futhermore, you must also include your Action class files referenced in struts.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.
Some advanced users may wish to execute SiteGraph from within their application - this could be required if you are developing an application that supports plugin capabilities. This can easily be done. See the JavaDocs for more info:
An error occurred: https://svn.apache.org/repos/asf/struts/struts2/trunk/core/src/main/java/org/apache/struts2/sitegraph/SiteGraph.java. The system administrator has been notified.The command line version of SiteGraph does exactly this (except for overriding the Writer):
An error occurred: https://svn.apache.org/repos/asf/struts/struts2/trunk/core/src/main/java/org/apache/struts2/sitegraph/SiteGraph.java. The system administrator has been notified.