I have no idea whether I did it the right way but it worked. Rendering the template in your execute method does not have any effect. You don’t take the result and even if you would you can’t use it.
You may try to return success only and implement a function in your action class which can be called from the Velocity template delivering the data you need.
An example of one of my action classes is: Bitbucket
@andrey.bobrov The best thing to do would be to buy a $10/10 user Confluence Server license and download the source code. This is the best tutorial you can buy.
For xwork actions, all variables in the vm template should be member variables.
Here’s something that should give you an idea…
package com.example.confluence.action;
import com.atlassian.confluence.core.ConfluenceActionSupport;
import com.atlassian.user.User;
public class YourConfluenceAction extends ConfluenceActionSupport {
private User user;
public String doDefault() {
UserService userService = new UserService();
user = userService.getUser();
return SUCCESS;
}
public User getUser() {
return user;
}
}