发现网址404未找到

时间:2016-01-25 13:53:15

标签: angularjs spring spring-mvc

我正在使用angular.js和Spring MVC。 我的UI代码是

<html>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<body>

 < div ng-app="myApp" ng-controller="myCtrl">

 < input type="text" ng-model="firstname">

 < input type="text" ng-model="lastname">

 < input type="text" ng-model="username">

 < input type="text" ng-model="password">

 < button ng-click="myFunction()"></button>

  < /div>
<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope,$http) {    
$scope.myFunction = function() {

   var fname=$scope.firstname;
   var lname=$scope.lastname;
   alert("firstname "+fname+"lastname "+lname);
   var sd={"fn":fname,"ln":lname};
   $http.post('newreg', {"firsname" : "ram"}).success(function(data){
        alert("Success");
    });
   };
  });
</script>
< /body>
 < /html>

我的Spring控制器代码是:

@RequestMapping(value="/newreg",method = RequestMethod.POST)
public String urlviewer(@RequestParam(value = "firsname") String firstname,Model model){
    System.out.println("first name "+firstname);
    return "newpage";

}

它适用于没有获取或发布请求的其他方法。  我已经包括以下罐子:

    commons-logging-1.1.1.jar

    jackson-core-asl-1.6.3.jar

    jackson-jaxrs-1.6.3.jar

    jackson-mapper-asl-1.6.3.jar

    jstl-1.2.jar

    junit-4.11.jar

    spring-aop-3.2.5.RELEASE.jar

    spring-beans-3.2.5.RELEASE.jar

    spring-context-3.2.5.RELEASE.jar

    spring-context-support-3.2.5.RELEASE.jar

    spring-core-3.2.5.RELEASE.jar

    spring-expression-3.2.5.RELEASE.jar

    spring-jdbc-3.2.5.RELEASE.jar

    spring-orm-3.2.5.RELEASE.jar

    spring-tx-3.2.5.RELEASE.jar

    spring-web-3.2.5.RELEASE.jar

    spring-webmvc-3.2.5.RELEASE.jar

我是否必须加入更多罐子?

0 个答案:

没有答案