angularjs - send json data to struts using angular js -
i receiving data null in struts2 action class.
following code written on jsp page.sending linedetails struts2 action class. var app = angular.module('myapp', ['ngroute']); app.controller('mycontroller', ['$scope', '$http', function($scope, $http) { var linedetails = {lineid:0};
var data=angular.tojson(linedetails); $http.post("actionclassname",data, {headers: {'content-type': 'application/json'} }).success(function(data, status, headers, config) { }).error(function(data, status, headers, config) { alert( "failure message: " ); }); }]); in action class in accessing data variable printing null gson gs=new gsonbuilder().serializenulls().create(); system.out.println("data is:"+data);
Comments
Post a Comment