How get some parameters from a .vm to a java class?


I can passed from java to .vm but i don't how to do the inverse.

Thanks for your help.

1 answer

1 accepted

I'm not sure if this will suit your application, but when I have to send a value back to Confluence, I use a small JS wich post the information back to Confluence when I have a servlet waiting for the reply (my class extends ConfluenceActionSupport and implements ServletRequestAware). Here you have some code snippets:

  • Javascript:
AJS.$(function() {
   AJS.$.post($var.attr("action"), { var1: "value1", var2: "value2" }, function(xmlresponse) {

  • Java:
public class MyClassAction extends ConfluenceActionSupport implements ServletRequestAware, PageAware {
    private String var1;
    private String var2;

    public String execute() throws Exception {
    public void setVar1(String value)
        this.var1 = value;
    public void setVar2(String value)
        this.var2 = value;

Thanks i will try.


I think you need to clarify this: velocity templates are used to generate the HTML. Once it is generated, it is sent back to the client. End of story. To go back on the server side, you will need to make a HTTP request again (either by AJAX - like above - or by normal means, i.e. <form action="/secure/Blabla.jspa" method="post"> .... </form>

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Tuesday in Marketplace Apps

If you’re an Atlassian app developer, you’ll want to know about Atlas Camp!

This September 6-7, hundreds of Atlassian App developers will flock to Barcelona Spain to build skills, discover product roadmaps, meet face-to-face with the Atlassian team, and learn how to extend t...

113 views 0 3
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