Hi
I am migrating a small custom plugin to Confluence 9.2.4. It has simple global and per-space configuration views, which display a form to view and update values from the Bandana settings (via PluginSettingsFactory). Loading and rendering the form and values works fine. However, when the user enters text and clicks on the ‘Save’ button, the form parameters no longer get injected into the Action class. This worked fine in Confluence 7 and 8 but no longer in Confluence 9. And I have no clue why
To summarize everything relevant in a simplified way, I have an xwork action like this:
<action name="ea-global-config-save" class="EAGlobalConfigAction" method="execute">
<param name="permittedMethods">GET,POST</param>
<param name="RequireSecurityToken">false</param>
<result name="success" type="redirect">/admin/eadiagram/ea-global-config-view.action</result>
</action>
Then a Velocity template including two text fields and a Save button (omitting all divs, labels etc for brevity):
<form class="aui" method="POST" action="ea-global-config-save.action">
<input id="eaDisplayUrl" name="eaDisplayUrl" class="text long-field" type="text" value="${action.eaDisplayUrl}"/>
<input id="eaUrl" name="eaUrl" class="text long-field" type="text" value="${action.eaUrl}"/>
<input type="submit" class="button" value="$i18n.getText("update.name")"/>
</form>
Then I have a Java class with an execute()
method that properly gets called when clicked on the Save button:
public class EAGlobalConfigAction extends ConfluenceActionSupport {
// form fields in the global EA plugin configuration
private String eaDisplayUrl;
private String eaUrl;
private PluginSettingsFactory pluginSettingsFactory;
public void setPluginSettingsFactory(PluginSettingsFactory pluginSettingsFactory) {
this.pluginSettingsFactory = pluginSettingsFactory;
}
public String execute() {
logger.debug("eaDisplayUrl: {}", eaDisplayUrl); // always 'null'
logger.debug("eaUrl: {}", eaUrl); // always 'null'
return SUCCESS;
}
public void setEaDisplayUrl(String url) {
logger.debug("setEaDisplayUrl() is called with url '{}'", url); // NEVER CALLED!!
eaDisplayUrl = url;
}
public void setEaUrl(String url) {
logger.debug("setEaUrl() is called with url '{}'", url); // NEVER CALLED!!
eaUrl = url;
}
}
When I click the ‘Save’ button, I can confirm that the parameters are getting sent as a payload of the POST request (e.g., eaDisplayUrl=blabla&eaUrl=adsadf
), but they don’t arrive in my Action class. In Confluence 8, the setter methods auto-magically got called to populate the private fields. But in Confluence 9 this no longer works.
Helpful hints would be highly appreciated. Thanks.
Dominik