title: how to redirect to other page when request is made using angularjs to spring controller
body: <pre><code>#MY Login page code snippet
  --------------------------------
  
      &lt;div class="login-container"&gt;
              &lt;form ng-submit="onLogin()" name="form" class="pure-form login-form"
                  ng-controller="LoginCtrl as vm"&gt;
                  &lt;fieldset class="pure-group"&gt;
                      &lt;legend&gt;Log In&lt;/legend&gt;
                      &lt;label for="inputUsername" class="sr-only"&gt;Username&lt;/label&gt; &lt;input type="text" id="inputUsername" class="form-control"
                          placeholder="Username" required autofocus ng-model="vm.username"&gt;
                      &lt;label for="inputPassword" class="sr-only"&gt;Password&lt;/label&gt; &lt;br&gt;
                      &lt;input type="password" id="inputPassword" class="form-control"
                          placeholder="Password" required ng-model="vm.password"&gt;
                  &lt;/fieldset&gt;
  
                  &lt;button type="submit"
                      class="pure-button pure-input-1 pure-button-primary"&gt;Log In&lt;/button&gt;
                  &lt;div class="alert alert-danger" role="alert" ng-show="errorMsg"&gt;{{errorMsg}}&lt;/div&gt;
  
              &lt;/form&gt;
          &lt;/div&gt;
  
  
          &lt;div id="content" class="col-lg-10 col-sm-10"&gt;
              &lt;div class="row"&gt;
                  &lt;div class="box col-md-12"&gt;
                      &lt;div class="box-inner"&gt;&lt;/div&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
  
  
  # login.js
  -----------------
  
  angular.module('loginApp', [])
          .controller('LoginCtrl', ['$scope', '$http', function ($scope, $http) {
              $scope.onLogin = function () {
  
          var encodedString = '?username=' +
                      encodeURIComponent($scope.vm.username) +
                      '&amp;password=' +
                      encodeURIComponent($scope.vm.password);             
  
                  var url = "http://localhost:8080/servicesummary/employees/view"+encodedString;
  
                  $http({
                      method: 'GET',
                      url: url                
                  })
                  .success(function(data) {
                      //alert(JSON.stringify(data));
                      var container = 'box-inner';
  
                      $('.' + container).html(response);  
  
  
                  })
                  .error(function(data) {
                      $scope.$error = 'Unable to submit form';
                  })
              };
  
          }]);
  
  
  # Spring Controller-
  --------------------------
  
    @RequestMapping(value = "/view", method = RequestMethod.GET, produces = "application/json")
   public ModelAndView getEmployeeInJSON(@RequestParam("username") String username, @RequestParam("password") String password) {
  
              final ModelAndView mv = new ModelAndView();
              try {
                  AppUserDTO appUserdb = userService.getObject(username);
  
                  if (null != appUserdb &amp;&amp; (appUserdb.getPassword() != null)) {
                      String decodedPass = UtilityService.decode(appUserdb.getPassword());
                      if (decodedPass.equals(password)) {
  
                      System.out.println("Database Match.............");
                      mv.setViewName(VIEWNAME_HOME);
                      } else {
                          mv.setViewName(VIEWNAME_LOGIN);
                      }
                  } else {
                      mv.addObject("uNameNotValid", false);
                      mv.setViewName(VIEWNAME_LOGIN);
                  }    
              } catch (Exception e) {
                  logger.error("ERROR handleGetLogin() {}", e);
                  System.out.println("Exception is occured.....");
                  return new ModelAndView("redirect:/home-exception");    
              }    
              return mv;
          } 
  </code></pre>
  
  <hr>
  
  <p>Hi i have user input username and password which i trying to validate from database using spring controller (TestController.java) from angularjs. i am bale to call controller using login.js written, but not able to process the ModelAndView object returned using angularjs. please see my login.js for reference.</p>