Writing a mixed Space screen


This tutorial applies to Confluence 5.0.

Level of experience:

This is an advanced tutorial. You need to understand the Confluence Actions, templates and decorators.

This tutorial will explain how to display a Space screen in both situations:

Doc Theme Default Theme in Confluence 5.0
Displayed as a top-level Space tab Displayed as a Space Tool

We call it a mixed screen because:

  • In the Doc Theme, top-level tabs should display types of content, like Pages, Blog or Mail.
  • If you want to display settings for your add-on, they should appear under the Space Admin tab.

However we understand it makes sense for add-on developers to mix those two patterns.


The example below is available on the following BitBucket repository:



As for the two previous tutorials, one web-item is required for each place:

    <!-- Mixed Screen: Top-level Space tab in Doc Theme -->
    <web-item key="space-tab-link-for-mixed-screen" name="Top-level tab for the mixed screen" section="system.space" weight="50">
        <label key="mixed.screen.title"/>
        <link id="mixed-screen-tab-id">/plugins/${project.artifactId}/mixed.action?key=$generalUtil.urlEncode($helper.spaceKey)</link>
        <condition class="com.atlassian.confluence.plugin.descriptor.web.conditions.SpaceSidebarCondition" invert="true"/>
    <!-- Mixed Screen: Space Tools tab -->
    <web-item key="space-tools-link-for-mixed-screen" name="Space Tools tab for the mixed screen" section="system.space.tools/addons" weight="50">
        <label key="mixed.screen.title"/>
        <link id="mixed-screen-space-tools-id">/plugins/${project.artifactId}/mixed.action?key=$generalUtil.urlEncode($helper.spaceKey)</link>


An XWork definition will allow you to display the action:

    <xwork name="Example Actions" key="example-actions">
        <description>Examples of actions</description>
        <package name="space-links-xwork-package" extends="default" namespace="/plugins/${project.artifactId}">
            <default-interceptor-ref name="validatingStack"/>
            <action name="mixed" class="com.atlassian.examples.MixedAction" method="doDefault">
                <result name="input" type="velocity">/templates/mixed-space-screen.vm</result>
public class MixedAction extends SpaceAdminAction
    public String doDefault()
        return INPUT;

Use two decorators

        <meta name="decorator" content="main"/>

            #decoratorParam("helper" $action.helper)
            <!-- context is the web-item key. It must start with "space-" to display the space tabs. -->
            #decoratorParam("context" "space-tab-link-for-mixed-screen")
            #applyDecorator ("root")
                #decoratorParam ("context" "spacetoolspanel")
                #decoratorParam("helper" $action.helper)
                #decoratorParam("selectedSpaceToolsWebItem" "space-tools-link-for-mixed-screen")
                    <p>This screen displays both as a top-level tab when the Doc Theme is activated, and as a Space Tools when the default theme is used.</p>


The action is available at http://localhost:1990/confluence/plugins/space-links/mixed.action?key=dsThe two images of the introduction show how the action displays.

Related Content

Web UI Modules

Was this page helpful?

Have a question about this article?

See questions about this article

Powered by Confluence and Scroll Viewport