Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

xhtml-macro: Variable number of parameters and adding parameter values through java code

Background:

I have started with programming Confluence Macros.
I have added the <xhtml-macro> tag to my atlassian-plugin.xml
I have created a Java class that implements the Macro Interface.
The Macro is working so far.

What I want to do and haven't found a way to do so far:
(1) I want to dynamically add parameter values to an enum based parameter depending on what is the content of the confluence page the user is currently working on.
(It doesn't necessarily need to be a enum based parameter, but there should be values to choose from.

(2) I want the user to be able to dynamically add new parameters. This kind of feature is already available in the content by label Plugin, where you can add as many filters as you like.

What is the right way to approach this?

Thanks you!

2 answers

1 accepted

0 votes
Answer accepted

Unfortunatly I haven't found any way to solve this via pure Java.

An alternative however is to work with Javascript, where you process all the data the user has given in the input fields of the macro and use a key value pair format, for instance JSON, to code all the information you need as a String. Then in your Java code you can decode the JSON, that is all the parameters that you have put into just one parameter beforehand.

Hi. I have the same question and could not find anything proper. Have you solved the problem? If yes can you please answer.

Hey!

Unfortunatly I haven't found any way to solve this via pure Java.

An alternative however is to work with Javascript, where you process all the data the user has given you and use a key value pair format for instance JSON to code all the information you need as a String. Then in your Java code you can decode the JSON that is all the parameters that you have put into just one parameter beforehand.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Confluence

Confluence Mythbusters: Does Atlassian even use Confluence?

Hi, Confluence collaborators! As part of #Confluence-Collaboratory month, we’ve created a very special Mythsbusters segment, where we're dive into an interesting myth and uncover the truth behind i...

1,384 views 7 29
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you