title: Login Validation Using Angular Js and JSP
body: <p>I am making an angular js - jsp application, for that I have created a login page, also I have created a servlet for  fetching database and comparing username and password. 
  created login form and passed values my angular controller on login form submit. now I need to access the servlet that compares the login how do I pass information to servlet ? I have created a factory for that, also I have to use post method for passing datas.</p>
  
  <p>I am pasting code til I have done.</p>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>&lt;div class="container"&gt;
  
          &lt;form name="myForm" novalidate class="col-md-4 col-md-offset-4"&gt;
          &lt;h2&gt;{{login.username}}&lt;/h2&gt;
              &lt;div class="form-group"&gt;
                  &lt;input type="email" ng-model="login.username" required class="form-control input-lg" placeholder="Email"&gt;
              &lt;/div&gt;
  
              &lt;div class="form-group"&gt;
                  &lt;input type="password" required ng-model="login.password"  class="form-control input-lg"
                      placeholder="Password"&gt;
  
              &lt;/div&gt;
  
              &lt;div class="form-group"&gt;
                  &lt;input type="submit" ng-disabled="myForm.user.$dirty &amp;&amp; myForm.user.$invalid ||  
  myForm.email.$dirty &amp;&amp; myForm.email.$invalid"  ng-click="formSubmit(login)" class="btn btn-primary btn-lg btn-block" value="Sign In"/&gt;
                  &lt;span&gt;&lt;a href="#"&gt;Need help?&lt;/a&gt;&lt;/span&gt; &lt;span class="pull-right"&gt;&lt;a
                      href="#"&gt;New Registration&lt;/a&gt;&lt;/span&gt;
              &lt;/div&gt;
  
          &lt;/form&gt;
  
      &lt;/div&gt;
  </code></pre>
  
  <p><strong>Controller.js</strong></p>
  
  <pre><code>var appController = angular.module('appController', []);
  
  
  appController.factory('AccountGroup', ['$resource', 'Data', function ($resource, Data) {
    return $resource( 
      {
        query: {
          isArray: true,
          method: 'POST'
        }
      }
    );
  }]);
  
  appController.controller('LoginController', ['$scope','$http', function ($scope,$http) {
  
        $scope.formSubmit = function(item) {
            debugger;
              console.log(item);
            };
  
  
  }]);
  </code></pre>
  
  <p>This is my eclipse directory structure</p>
  
  <p><img src="https://i.stack.imgur.com/VUlr8.png" alt="enter image description here"></p>
  
  <p>LoginValdiator.java is the servlet used for login comparison</p>