I am currently working on a banking project using JSP and angular 1.3.2. I have encountered an issue with a form where, upon blurring after typing the customer number, the customer's information such as name and address should be displayed if the customer exists. However, in my case, everything is showing up even when testing with a simple string in the servlet. The alert in the angular controller is also not displaying anything. I need help to identify and fix this issue. Any assistance would be greatly appreciated. Thank you in advance. Below are the relevant codes: JSP Page
var banking = angular.module('banking', []);
banking.controller('accountCtrl', ['$scope', '$http',
function($scope, $http) {
$scope.getClient = function() {
$http({
method: 'GET',
url: 'account',
params: {
action: "getClient",
numClient: $scope.numClient
}
}).success(function(data, status, headers, config) {
alert(ok);
$scope.nameCli = data.nomComplet;
$scope.adresse = data.adresse;
$scope.email = data.email;
$scope.tel = data.telephone;
$scope.sexe = data.sexe;
$scope.datenaiss = data.dateNaissance;
});
};
alert("ok");
}
]);
...
Servlet</p>
<pre><code>@WebServlet(name = "Account_Servlet", urlPatterns = {"/account"})
public class AccountServlet extends HttpServlet {
@EJB
private CompteEJBLocal compteEJB;
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
//response.sendRedirect("/home/ajouter_compte.jsp");
System.out.println("ok");
String action = request.getParameter("action");
System.out.println("action " + action);
switch (action) {
case "getClient": {
String numCli = request.getParameter("numClient");
Client foundCli = compteEJB.unClient(numCli);
System.out.println("client " + foundCli);
ObjectMapper map = new ObjectMapper();
String json = map.writeValueAsString(foundCli);
response.getWriter().println(json);
}
break;
default: {
}
break;
}
}