-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