Can anyone please help me to understand how should i access json data in js. JSP-struts code to access. i am using struts2 , json, dojo. But getting issue accessing the data.
var chartData = dojo.xhrGet({
url : "getJSONResult",
handleAs : "json",
preventCache : false,
load : function(data) {
//how to process
}
});
my struts.xml
<package name="json" namespace="/" extends="json-default">
<action name="getJSONResult" method="execute"
class="uk.co.bandc.businessmonitor.web.controller.ShowTransactionAction">
<result type="json" />
</action>
</package>
My action class
package uk.co.bandc.businessmonitor.web.controller;
import com.opensymphony.xwork2.ActionSupport;
public class ShowTransactionAction extends ActionSupport {
/**
*
*/
private static final long serialVersionUID = 1L;
int[] numberarray1 = { 10000, 9200, 11811, 12000, 7662, 13887, 14200, 12222, 12000,
10009, 11288, 12099 };
public String execute() {
return SUCCESS;
} // End execute()
public int[] getNumberarray1() {
return numberarray1;
}
public void setNumberarray1(int[] numberarray1) {
this.numberarray1 = numberarray1;
}
} // End class