Struts 2 Config Browser Plugin - Get Information About Your Application's Configuration
Introduction
I recently began reading Apache Struts 2 Web Application Development [1] by Dave Newton. In chapter 2 Dave introduces the Struts 2 config browser plugin [2]. I'd not heard of that Struts 2 plugin before, but after using it as part of the book's example application I can see where this plugin will be useful in all my Struts 2 web applications.
Struts 2 Config Browser Plugin
The Struts 2 config browser plugin provides details about the configuration the Struts 2 framework is using to run your application. To use the plugin your application needs to have the struts2-config-browser-plugin-2.1.6.jar in your application's WEB-INF/lib folder. Reference 2 explains how you can download the jar (2.1.6 is the latest version). If you use Maven, you can just add this dependency to your pom.xml:
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-config-browser-plugin</artifactId>
<version>2.1.6</version>
<type>jar</type>
<optional>false</optional>
</dependency>
To use the plugin in your application, just call the index.action in namespace config-browser. For example you could have the following link on your admin page (or just anywhere during your development).
<a href="<s:url action="index" namespace="config-browser" />">Launch the configuration browser</a>
Example Applications
You can view an example application that uses the Struts 2 config browser plugin here. I also put together two simple example applications that you can download, run, and view the source code to see how the config browser plugin works.
MyEclipse Example Application
Download the archived MyEclipse Struts 2 Config Browser Plugin example. You can import the archived project directly into MyEclipse (File - Import - Existing Projects Into Workspace [under General]) and then run the application using the Tomcat server built into MyEclipse.
Maven Example Application
Download the zipped Struts 2 Configuration Plugin example that is a Maven project. If you're not familiar with Maven [11,12] checkout the references section at the end of this article. After downloading the zip file, unzip it to a directory on your computer. In a command window, navigate to where you unzipped the file. Go to directory Struts2_Configuration_Plugin. In that directory run the command mvn clean. Then run the command mvn jetty:run. This command will launch the Jetty application server [13]. When you see the [INFO] Started Jetty Server open your web browser and go to this url: http://localhost:8080/Struts2_Configuration_Plugin/index.jsp. On that page you'll find a link showing the configuration plugin's results.
Using The Config Browser Plugin
When you run one of the example applications, you'll see this web page (index.jsp) when the application first starts:
Click on the Launch the configuration browser link and you'll see this page which the index.action creates and returns to your browser:
This simple application just has one action defined in struts.xml so that's all you see here. If you click on the action name, you'll see this information:
This view shows the class associated with the action and the result types defined for the action. Just below the Default location line is a tabbed menu that you can use to view the exception mappings, interceptors, properties, and validators associated with this action.
On the left side of the page is the config browser plugin menu. Clicking on constants will render a view that list all the Struts 2 constants and their properties for your application.
Clicking on beans did not work for me. I got an InvocationTargetException error in org/apache/struts2/config_browser/ShowBeansAction.java.
Clicking on Jars shows the jars your application is using.
Summary
To use the Struts 2 config browser plugin you just need its jar in WEB-INF/lib in your application. Then call the index.action in namespace config-browser. The plugin will create views and return them to your browser to provide much useful information on the Struts 2 configuration being used by your application.
When you have numerous actions with customized exception mapping, validation, results, and interceptors this plugin can be very handy in both trouble shooting any problems and providing documentation for your application.
References
- Apache Struts 2 Web Application Development, Dave Newton, June 2009, Packt Publishing
- Config Browser Plugin, Apache Struts 2
- Using the Struts 2 Validation Framework, Bruce Phillips Blog Article
- Introduction to The Struts 2 Java Web Application Framework, Bruce Phillips Blog Article
- The Apache Software Foundation, Struts
- Struts Key Technologies Primer
- Struts User Mailing List
- Struts 2 Version 2.1.6
- Struts 2 Documentation
- Struts 2 Version 2.1.6 Tag Reference
- Apache Maven Project
- Maven: The Definitive Guide, http://www.sonatype.com/books/maven-book/reference/public-book.html
- Jetty, http://jetty.mortbay.org/jetty5/index.html
- MyEclipse Example Application Download
- Maven Example Application Download
- View Example Application Online


Where can i find this Configuration plug-in jar? I'm unable to find that struts2 site. Can you please provide the download link, if u know that...
Thanks,
Muthu
download the struts-2.1.6-lib.zip. Unzip it and you'll find the configuration plugin jar in the lib folder.
Did someone find that this plugin show errors when we want it show the confinguration of beans?
is it a bug?
I don't know if this was reported to the Struts 2 developer's list or Jira of Struts 2 bugs.