XWork plugin modules are available in Confluence 1.4 and later.

XWork plugin modules enable you to deploy XWork / WebWork actions and views as a part of your plugins.

The XWork Plugin Module

Each XWork module is deployed as a plugin module of type xwork and contains one of more XWork package elements.

Here is an example atlassian-plugin.xml file containing a single XWork module:

<atlassian-plugin name='List Search Macros' key='confluence.extra.livesearch'>
    ...

    <xwork name="livesearchaction" key="livesearchaction">
        <package name="livesearch" extends="default" namespace="/plugins/livesearch">
            <default-interceptor-ref name="defaultStack" />

            <action name="livesearch" 
                class="com.atlassian.confluence.extra.livesearch.LiveSearchAction">
                <result name="success" type="velocity">
                /templates/extra/livesearch/livesearchaction.vm
                </result>
            </action>
        </package>
    </xwork>
</atlassian-plugin>

Writing an Action

For information on how to write a WebWork action, please consult the WebWork documentation.

WebWork actions must implement com.opensymphony.xwork.Action. However, we recommend you make your action extend ConfluenceActionSupport, which provides a number of helper methods and components that are useful when writing an Action that works within Confluence.

Other action base-classes can be found within Confluence, but we recommend you don't use them - the hierarchy of action classes in Confluence is over-complicated, and likely to be simplified in the future in a way that will break your plugins.

Accessing Your Actions

Actions are added to the XWork core configuration within Confluence, which means they are accessed like any other action!

For example, given the above atlassian-plugin.xml, the livesearch action would be accessed at http://yourserver/confluence/plugins/livesearch/livesearch.action.

Notes

Some issues to be aware of when developing or configuring an XWork plugin:

Example

The LiveSearch example is a neat example of an Ajax-style Confluence plugin which uses a bundled XWork module to do it's work:

Find this example in the /plugins/macros/livesearch directory within your Confluence distribution.