-1
好吧我有一系列的servlet我的項目JavaScript文件未找到
內如果我叫,像這樣一個servlet:
$scope.register=function()
{
$http({
method : 'POST',
url : './registration',
data : "role=" + $scope.role+"&name=" + $scope.name + "&salary=" + $scope.salary+"&username=" + $scope.username + "&phone=" + $scope.phonenumber+
"&password=" + $scope.pass + "&add=" + $scope.additional,
headers : {
'Content-Type' : 'application/x-www-form-urlencoded'
}
}). success(function(data) {
alert("changed");
}).
error(function(data) {
alert("Servlet Call Error");
$scope.message="Servlet call error";
});
}
它的工作原理但是如果我使用工廠我404找不到
app.factory('employeeFactory', function($http){
return {editServlet: function(scope, http,toChange,changeTo) {
$http({
method : 'POST',
url : './editInformationServlet',
data : 'username=' + scope.editEmp + '&toChange=' + toChange+'&changeTo='+changeTo,
headers : {
'Content-Type' : 'application/x-www-form-urlencoded'
}
}). success(function(data) {
}).
error(function(data) {
});
}
我使用路線提供商轉到另一個頁面,這可能是問題嗎? 還是別的嗎?我真的需要幫助我的工作是在線
我試過使用絕對的URL。至少我認爲這是對的。它在src/com.peterson.database.servlet/servletName – user2786754
你在做什麼? servlet URL映射到web.xml中(或者與Servlet 3.0 API中的@ WebServlet註釋)。它與源文件無關。 –
當我在工廠內調用我的servlet時,你必須給它url ...... – user2786754