Angular js控制器
var data = {"username" : $scope.username,"password" : $scope.password};
$scope.sign = function($location, $window, $rootScope) {
$http({
method : 'POST',
url : '/Newproject/getin.action',
params : {value:data},
headers : {
'Content-Type' : 'application/x-www-form-urlencoded'
}
}).success(function(data) {
});
struts.xml中(动作)
<action name="getin" class="com.cibin.SignInAction">
<result name="success" type="tiles">/welcome.home
<param name="value">value</param></result>
<result name="input">/index.jsp</result>
<result name="error">/index.jsp</result>
<result name="loginpage">/index.jsp</result>
</action>
SignInAction.java
public String execute() {
String contactJsonData = request.getParameter("value");
System.out.print(contactJsonData);
return "success";
}