On this tutorial we will show how easily your application can be made extensible using Struts 2 plugins mechanism.
First thing we have to do is define an interface that our plugins will implement. This interface must be available to both your web application and the plugins, so keeping it on a separate jar is a good idea.
Now lets create an Struts 2 plugin. Creating a plugin is a simple task, all you need to do is build a jar with your classes, and a file called struts-plugin.xml on its root. First, the class implementing the interface defined on the first step.
To install the plugin into your application, just drop the jar file under WEB-INF/lib.
Now, lets get Struts 2 inject an instance of com.opensymphony.xwork2.inject.Container into our action, which we will use to discover available plugins at runtime.