I am having trouble finding why my application is throwing errors at one path but not the other.
My angular application functions fine at the following URL with my default servlet.
http://localhost:8080/#/
web.xml
<servlet-mapping>
<servlet-name>cr</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
I would expect with the below servlet mapping that I should be able to access another application with the following url.
http://localhost:8080/admin/
web.xml
<servlet>
<servlet-name>admin</servlet-name>
<jsp-file>/resources/admin/index.jsp</jsp-file>
</servlet>
<servlet-mapping>
<servlet-name>admin</servlet-name>
<url-pattern>/admin/*</url-pattern>
</servlet-mapping>
However it throws the following errors constantly until I pause the page in my chrome debugger.
SyntaxError: Unexpected token <
The admin application however does function if I go to the following URL.
http://localhost:8080/admin#/
For reference here is my app.js
'use strict';
var AdminApp = angular.module('AdminApp', ['AdminApp.services'])
.config(['$routeProvider', function ($routeProvider) {
// default route
$routeProvider.when('/', {templateUrl: 'resources/admin/views/dashboard.jsp', controller: 'DashboardCtrl'}).otherwise({redirectTo: '/'});
}]);
main.js
//Dashboard Controller
AdminApp.controller('DashboardCtrl', function ($scope) {
});
service.js
var service = angular.module("AdminApp.services", ['ngResource']);
Note: I know that the app, main, and service are not actually doing anything, I am just trying to get the shell working before I start extending it with valid data.
Here is the order in which I initiate everything.
After I changed my web.xml to below it functioned as expected. I still do not know why it was throwing errors.
<servlet>
<servlet-name>admin</servlet-name>
<jsp-file>/resources/admin/index.jsp</jsp-file>
</servlet>
<servlet-mapping>
<servlet-name>admin</servlet-name>
<url-pattern>/admin/</url-pattern>
</servlet-mapping>