I am creating an angular js - jsp application for which I created a login page, also I created a servlet to retrieve the database and compare username and password. created a login form and passed the values ββto my angular controller in the login form. now I need to access a servlet that compares the login, how do I pass information to a servlet? I created a factory for it, also I have to use the post method to transfer data.
I insert the code until I execute it.
HTML
<div class="container"> <form name="myForm" novalidate class="col-md-4 col-md-offset-4"> <h2>{{login.username}}</h2> <div class="form-group"> <input type="email" ng-model="login.username" required class="form-control input-lg" placeholder="Email"> </div> <div class="form-group"> <input type="password" required ng-model="login.password" class="form-control input-lg" placeholder="Password"> </div> <div class="form-group"> <input type="submit" ng-disabled="myForm.user.$dirty && myForm.user.$invalid || myForm.email.$dirty && myForm.email.$invalid" ng-click="formSubmit(login)" class="btn btn-primary btn-lg btn-block" value="Sign In"/> <span><a href="#">Need help?</a></span> <span class="pull-right"><a href="#">New Registration</a></span> </div> </form> </div>
Controller.js
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); }; }]);
This is my eclipse directory structure

LoginValdiator.java is a servlet used to compare login
source share