I am creating a jira plugin, and I currently have a webwork module. I have the following class to represent the webwork:
public class ReportWebworkAction extends JiraWebActionSupport {
private ArrayList<String> dataList = new ArrayList<String>();
private String temp;
//setters and getters for all varaibles
@Override
public String doDefault() throws Exception {
//1) make http request
//2) parse json data
//3) display list of data in html table using velocity.vm
return super.doDefault();
}
}
Right now I am able to successfully make the http request and parse the data into a list of java objects. How can I look through that list in my velocity page and for each item create a element to display the data.
This is what I want to do:
#foreach($item in $dataList) {
<tr>
<td>$item.key</td>
<td>$item.name</td>
<td>$item.value</td>
</tr>
}
#end
My velocity page can't seem to recognize the $dataList item which is an ArrayList variable in my ReportWebworkAction class. It can access the string variable temp however.
I read that I need to use the Content Provider and the getContextMap() method, but I am confused of how to use that in a separate class. Can someone show me the correct way to do this? Thanks.