I am Trying to post data from angulajs and read it in struts action class.
Angularjs code is
$scope.dkPostData=function(){
$scope.myData={name:'Ramesh',class:'XII',Marks:'90%'};
$http.post('dkResult.do?method=JsonPostData',
myData).success(function(data, status, headers, config) {
alert("posted");
}).error(function(data, status) { // called asynchronously
if an error occurs// or server returns response with an error status.
});
}
Struts Action Class :
public ActionForward JsonPostData(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
System.out.println("The 1st Post Data----------------> ");
try{
JSONParser parser=new JSONParser();
JSONParser parser=new JSONParser();
String Mydata= request.getParameter("myData");
System.out.println("Master is :"+Mydata);
}catch(Exception e){
e.printStackTrace();
}
return null;}
Kindly advice how to post data in angular js and read the same form Action
class as above.
-Ramesh
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/groups/opt_out.