My class in the project is under a package com.project.controller and the name of the servlet class is UpdateDatabaseController. The corresponding code of the web.xml is,
<servlet>
<servlet-name>UpdateDatabaseController</servlet-name>
<servlet-class>com.project.controller.UpdateDatabaseController</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>UpdateDatabaseController</servlet-name>
<url-pattern>/UpdateDB</url-pattern>
</servlet-mapping>
In the html page, I have a button that is calling a function, updateDatabase(). And the code of the script is:
$scope.updateDatabase = function(){
$http.get('/UpdateDB').success(function(data) {
alert("Controller hit");
});
};
Whenever I hit the button, the error in the browser log is displayed, that : "NetworkError: 404 Not Found - http://localhost:8080/UpdateDB"
I want that on my button click, the POST method of the servlet class is invoked. But the error is fixed in the browser log. I am unable to solve this situation.