...
Since the struts.xml
file is always loaded last, it can make use of any resources provided by the plugins bundled with the distribution, or any other plugins available to an application.
Extension Points
Extension points allow a plugin to override a key class in the Struts framework with an alternate implemention. For example, a plugin could provide a new class to create Action classes or map requests to Actions.
...
Wiki Markup |
---|
{snippet:id=extensionPoints|javadoc=true|url=org.apache.struts2.config.BeanSelectionProvider} |
Plugin Examples
Let's look at two similar but different plugins bundled with the core distribution.
Sitemesh plugin
SiteMesh is a popular alternative to Tiles. SiteMesh provides a common look-and-feel to an application's pages by automatically wrapping a plain page with common elements like headers and menubars.
...
The two bean elements, with the "static" flag enabled, tell Struts to inject the current settings and framework objects into static property setters on startup. This allows, for example, the FreeMarkerPageFilter class to get an instance of the Struts FreemarkerManager and the current encoding setting.
Tiles plugin
Tiles is a popular alternative to SiteMesh. Tiles provides a common look-and-feel to an application's pages by breaking the page down into common fragments or "tiles".
...
Since the Tiles Plugin does need to register configuration elements, a result class, it provides a struts-plugin.xml
file.
Bundled Plugins
Plugin Registry
Struts has a Struts Plugin Registry, which lists both bundled and third-party plugins. Excerpt
Several plugins are available that extend the framework's capabilities.