Plugin's Space Admin Page Servlet Does Not Run doGet()

I’m trying to create a Space Admin page for my plugin. In general, this works but whenever I open that page, all the fields are loaded with their default values, not with the saved ones. Saving the settings (and other POST functions) works just fine, they arrive in the backend and can be used there. I just can’t get it to call my servlet’s doGet() method to fill the fields on page load.

It also doesn’t seem to load my js file, but I could do without that if need be.

I’m doing the same thing on a global plugin config page where it works just fine. So, I’m sure that I’m just missing some relatively simple wiring, but I’ve been staring at it on and off for a week now and can’t figure it out.

Any help would be appreciated.

in atlassian-plugin.xml:

    <web-resource key="test-spaceadmin-resources" name="Test Space Admin Resources">
        <dependency>com.atlassian.auiplugin:ajs</dependency>
        <resource type="download" name="spaceadminUI.js" location="/js/spaceadminUI.js"/>
        <context>test</context>
    </web-resource>

    <!-- Item in Space Tools -->
    <web-item key="space-admin-item" name="Test Plugin Space Admin" section="system.space.tools/addons" weight="80">
        <label key="test.admin.label" />
        <link linkId="space-admin-link-id">/plugins/${project.artifactId}/space-admin.action?key=$generalUtil.urlEncode($helper.spaceKey)</link>
        <conditions type="AND">
            <condition class="com.atlassian.confluence.plugin.descriptor.web.conditions.SpacePermissionCondition">
                <param name="permission">administer</param>
            </condition>
            <condition class="com.atlassian.confluence.plugin.descriptor.web.conditions.SpaceSidebarCondition"/>
        </conditions>
    </web-item>
    <!-- Item in Space Admin -->
    <web-item key="space-admin-item-2" name="Test Plugin Space Admin" section="system.space.admin/addons" weight="80">
        <label key="test.admin.label" />
        <link linkId="space-admin-quick-link-manager-id">/plugins/${project.artifactId}/space-admin.action?key=$generalUtil.urlEncode($helper.spaceKey)</link>
        <conditions type="AND">
            <condition class="com.atlassian.confluence.plugin.descriptor.web.conditions.SpacePermissionCondition">
                <param name="permission">administer</param>
            </condition>
            <condition class="com.atlassian.confluence.plugin.descriptor.web.conditions.SpaceSidebarCondition" invert="true"/>
        </conditions>
    </web-item>

    <xwork name="Space Admin Action" key="space-admin-action">
        <description>Action for Space Admin</description>
        <package name="space-admin-xwork-package" extends="default" namespace="/plugins/${project.artifactId}">
            <default-interceptor-ref name="validatingStack"/>
            <action name="space-admin" class="com.personal.plugin.confluence.admin.MySpaceAdminAction">
                <result name="input" type="velocity">/templates/spaceadmin.vm</result>
                <result name="success" type="velocity">/templates/spaceadmin.vm</result>
            </action>
        </package>
    </xwork>

    <servlet name="Space Admin Servlet"  class="com.personal.plugin.confluence.admin.SpaceAdminServlet"
             key="space-admin-servlet">
        <description>A servlet to handle space administration.</description>
        <url-pattern>/space-admin</url-pattern>
    </servlet>

    <rest key="rest-space" path="/space-admin" version="1.0">
        <description>Provides REST resources for the space admin UI.</description>
    </rest>

in SpaceAdminServlet.java:

package com.personal.plugin.confluence.admin;
@Scanned
public class SpaceAdminServlet extends HttpServlet {
	@Override
	public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
		pageBuilderService.assembler().resources().requireWebResource(
				"com.personal.plugin.confluence.test:test-spaceadmin-resources");
		
		// The things in here do not happen.

		response.setContentType("text/html;charset=utf-8");
		templateRenderer.render("templates/spaceadmin.vm", context, response.getWriter());
	}

	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse response) throws ServletException, IOException {
		pageBuilderService.assembler().resources().requireWebResource(
				"com.personal.plugin.confluence.test:test-spaceadmin-resources");
		
		// The things in here do happen.

		String spaceKey = req.getParameter("spaceKey");
		response.sendRedirect(req.getContextPath() + "/plugins/test/space-admin.action?key=" + spaceKey);
	}
}

in MySpaceAdminAction.java:

package com.personal.plugin.confluence.admin;

public class MySpaceAdminAction extends SpaceAdminAction
{
    @Override
    public String doDefault()
    {
        return INPUT;
    }
}

in spaceadmin.vm:

<html>
    <head>
        <title>$action.getText("space-admin.action")</title>
        <meta name="decorator" content="main"/>
        $webResourceManager.requireResource("com.personal.confluence.test:test-resources")
    </head>
    #applyDecorator("root")
        #decoratorParam("helper" $action.helper)
        ## Name of the tab to highlight: space-operations is also valid.
        #decoratorParam("context" "space-administration")

        #applyDecorator ("root")
            ## The .vmd to use - This one displays both in Space Admin and Space Tools.
            #decoratorParam ("context" "spaceadminpanel")
            ## Key of the web-item to highlight in Space Admin
            #decoratorParam ("selection" "space-admin-item-2")
            ## Key of the web-item to highlight in Space Tools
            #decoratorParam ("selectedSpaceToolsWebItem" "space-admin-item")
            #decoratorParam ("helper" $action.helper)
            <body>
	       <form id="admin" class="aui" action="$req.contextPath/plugins/servlet/space-admin?key=$generalUtil.urlEncode($helper.spaceKey)" method="POST">
                   <!-- all the fields live here -->
               </form>
            </body>
        #end
    #end
</html>

I did not manage to actually call the doGet() method. However, I am now filling the plugin’s space admin page’s fields on load via several getFieldName() methods in the Action class. Not exactly what I wanted to do but it does get the job done.

For completion’s sake, this is what the methods in the MySpaceAdminAction class look like:

    public String getFieldName() {
        return MyConfluencePluginSettingsHandler.getFieldName(this.getSpaceKey());
    }