How to use GeneralUtil in atlassian-plugin.xml


I was mimicing the Confluence Space IA plugin to create a space admin button in our template.

the line:

<link id="spacebar-settings-link">/spaces/spacetools.action?key=$generalUtil.urlEncode($helper.spaceKey)</link>

the final render doesn't seem to render correctly, I see the string literal instead of the actual space key.

What am I missing? I didn't see anything obvious in the atlassian-plugin.xml, and I couldn't find a help page outlining the usage.


6 answers

1 accepted

So it turned out the $helper is not a accessible by default object.

I ened up with:


thanks all for the suggestions.

You've put the generalUtil in velocity context?

The best way to do that is bring the $helper.spaceKey already encoded to the velocity template.

with Confluence, GeneralUtil is always in the velocity context. it's one of the default objects.

When you say 'I see the string literal' do you mean that you see '$helper.spaceKey' in the output?



This was close, but it was the $helper object that was null. I ended up using:


I guess I saw the helper so much I thought it was there by default.

@David Pinn, Yep. But I found my way around it.

I discovered that in JIRA, JiraWebActionSupport has method urlEncode, thus I could just do the following in my Velocity template:


Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Published yesterday in Confluence

Think you know shares vs. @mentions in Confluence? Take this collab quiz.

To anyone who doubts that Atlassians are a little too obsessed with collaboration, and tools related thereto, let me describe a recent discussion we had (which took place on our internal Confluence, ...

108 views 2 4
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you