I am developing a Confluence plugin that has a web item which triggers an action that communicates with a web service. When receiving the response I redirect to another page.
When I receive an error or no response at all I want to stay on the page and show an error message. It's absolutely ok to reload the page for that.
My action class inherits from ConfluenceActionSupport. So, I tried using addActionError() and addActionMessage() but without success. The page gets reloaded but no message appears.
Here's my atlassian-plugin.xml :
<xwork name="translate-xwork" key="translate-xwork">
<package name="translate-package" extends="default" namespace="/plugins/translate-package">
<default-interceptor-ref name="defaultStack"/>
<action name="translate-action" class="com.aoe.deepl.TranslateAction">
<result name="success" type="redirect">${translatedPage.urlPath}</result>
<result name="error" type="redirect">${page.urlPath}</result>
</action>
</package>
</xwork>
What am I doing wrong? Don't the standard Confluence pages show error messages set this way? Do I have to write a custom velocity template for that? Is redirecting to the current page the wrong approach? Where can I find the documentation for the XML attributes, i.e. what can I specify for the type attribute instead of 'redirect'?
Update:
My problem is very similar to this one: https://community.developer.atlassian.com/t/how-to-show-user-message-in-confluenceactionsupport-after-execute/2383 .
The only difference is that I don't want to run client-side code to show the message but server-side.
It should behave like when opening the Add-ons manager as an admin. In that case an AUI warning message is shown at the top when the page is loaded.
Thanks in advance!
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.