Confluence Docs 3.0 : XWork-WebWork Plugins This page last changed on Mar 02, 2009 by mryall.
| 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. For more information about plugins in general, read Confluence Plugin Guide. To learn how to install and configure plugins (including macros), read Installing and Configuring Plugins Manually. For an introduction to writing your own plugins, read Writing Confluence 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>
the xwork element has no class attribute. beneath this element, multiple package elements can be specified. These are standard XWork package elements, just as you would specify in xwork.xml. ## 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: Your packages should always extend the `default` Confluence package. It is useful to be aware of what this provides to you in the way of interceptors and result types. Extending any other package will modify that package's configuration across the entire application, which is not supported or desirable. You can give your packages any namespace you like, but we recommend using `/plugins/unique/value` - that is prefixing plugin packages with `/plugins` and then adding a string globally unique to your plugin. The only name you can't use is `servlet` as the `/plugins/servlet` URL pattern is reserved for Servlet Plugins. Views must be bundled in the JAR file in order to be used by your actions. This almost always means using Velocity views. It is useful to be aware of the actions and features already bundled with Confluence, for example your actions will all be auto-wired by Spring (see Accessing Confluence Components From Plugin Modules) and your actions can use useful interfaces like PageAware and SpaceAware to reduce the amount of work they need to do. ## Important Security Note If you are writing an XWork plugin, it is very important that you read this security information: XWork Plugin Complex Parameters and Security ## 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.

Document generated by Confluence on Nov 05, 2009 23:34