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

How to render my freemarker template from java?

Deleted user Aug 04, 2017


please I am new to Bamboo development and have some question, if you could hellp me.

I have this xWork:

<xwork key="viewNFTResults" name="View NFT Results">
<package name="nftResults" extends="buildResultView">
<action name="viewNFTResults" class="">
<result name="success" type="freemarker">/fragments/view-nft-results-log.ftl</result>

<web-item key="NFT:\${planKey}-\${buildNumber}" name="chainNFTResults" section="chainResults.subMenu/chainResults"
<label key="NFT Results"/>
<link linkId="NFT:\${planKey}-\${buildNumber}">/browse/nft_results/viewNFTResults.action?buildKey=${planKey}&amp;buildNumber=${buildNumber}</link>


First Question: please any exapmles what I can use instead of  extends="buildResultView", which choises?

Second Question: any examples about the action element? how the result element works?

Third Question: in the MyPostJobAction I implement PostJobAction and I override the excute method, because I need to get some data after every job is finished, here I want to render the view-nft-results-log.ftl file with new context, I do like that:

public class MyPostJobAction extends PlanResultsAction implements PostJobAction {

public void execute(@NotNull StageExecution stageExecution, @NotNull Job job,
@NotNull BuildResultsSummary buildResultsSummary) {

// for example i have here a map that I will fill with my own data
Map<String, Object> objectMap = new HashMap<String, Object>();

objectMap.put("NFTResults", Job);

//from here please how I can provide my ftl file with this map as a new context
and how to render the ftl file also from here after that?
thank you very much in advance. 


1 answer

1 vote

1. Don't extend PostJobActions, it's not meant for UI at all. It's an action that executes as part of the build process. If you need such thing at all, it should be a separate class.

2. Your action class should be sth like

public class MyAction extends BuildResultsAction {

public String execute() {
BuildResultSummary bs = getBuildResultsSummary();
//do stuff with the result
return SUCCESS; //this is ftl result

You DON'T render ftl template. Framework does it for you. If you want to use data from the action in the template you expose it by declaring a public method in the action class for instance, if you want to have this in the ftl:


 you do the following in the action:

public String getMyData() {
return "blah blah blah";

You can use other types than String of course. NFTResults

3. Action return element tells the framework what to do after your action depending on what your action returns. Your execute method returns a string. The string is the matched against defined return elements and matching action is executed. The action can be  for instance rendering an ftl template or redirecting to another action.

Deleted user Aug 08, 2017

Hi Marcin,

Thank you, your answer solved one problem but I still have another one, if you can help me please.

I implemented PostJobAction here becasue I need to perform a functionaltily when the every job is finished and provide the result once agian to the ftl file to show it inside the tab.

That is why I asked about render ftl template from java code.

So, I need to render the ftl template UI after evrey job is finished.


Thank you very much in advance. 

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bamboo

Bamboo Data Center Apps Program coming soon

G’day Bamboo customers, As we approach GA for Bamboo Data Center , we would like to inform you that the Data Center Apps Program for Bamboo starts this quarter. How long does it take? We are g...

70 views 0 6
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