Confluence Plugin developing with xwork and apache velocity file


I am trainee at one computer company. My supervisor wanted me to make confluence plugin in order to do that i decided to use xwork. I create one button in this way and this .xwork directs it to new page which is .vm

My code in atlassian-plugin.xml is here:

<xwork name="add-draft-label-action-xwork" key="add-draft-label-action-xwork">
    <description key="">Defines what the "Add 'draft' label" action does.</description>
        <package name="add-draft-label" extends="default" namespace="/plugins/add-draft-label">
        <default-interceptor-ref name="defaultStack"/>
            <action name="add-label" class="com.atlassian.plugins.tutorial.AddDraftLabelAction">
			<result name="success" type="velocity">/hello.vm</result>               
			<!-- <result name="success" type="velocity">/templates/hello.vm</result> -->

			<!--   <result name="success" type="redirect">${page.urlPath}</result> -->

and My hello.vm is :

    <title>This is my Example action!</title>
    <meta name="decorator" content="atl.general" />
	Hello $name! what is up

and at the and my execute file which is in is here :

public String execute() throws Exception
        //  next, get the Template  *
        Template t = Velocity.getTemplate("hello.vm");
        // create a context and add data 
        VelocityContext context = new VelocityContext();
        String mes = "World";
        // now render the template into a StringWriter 
        StringWriter writer = new StringWriter();
        t.merge( context, writer );
        // show the World 
        System.out.println( writer.toString() );  

        return "success";

When i do all of them it only shows at screen Hello $name! what is up
but it should show Hello World! what is up

what should i do ? please help me.

1 answer

I notice your meta tag may have a type-o:


Notice: ALT.general

Nope, it's atl.general

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Dec 18, 2018 in Confluence Cloud

Happy holidays from our team to yours!

Hi Community!  2018 was filled with changes for our team, both big and small, and we've taken a lot of time to both celebrate our wins and recognize areas of improvement. One thing that we're a...

456 views 3 18
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