【发布时间】:2017-03-19 20:33:54
【问题描述】:
我正在将 spring mvc 项目配置为使用 angular 2 而不使用 spring boot。
我的目录结构是:
Project
|
+--src
|
+--resources
| |
| +--css
| |
| +--js
| |
| +--angular
| |
| +--app/
| |
| +--node_modules/
| |
| +--package.json,systemjs.config.js,tsconfig.json
|
|
+--WEB-INF
|
+--pages
|
+--index.jsp
我在 index.jsp 中包含了以下几行
<!-- 1. Load libraries for angular 2 setup -->
<!-- Polyfill(s) for older browsers -->
<script src="${pageContext.request.contextPath}/resources/angular/node_modules/core-js/client/shim.min.js"></script>
<script src="${pageContext.request.contextPath}/resources/angular/node_modules/zone.js/dist/zone.js"></script>
<script src="${pageContext.request.contextPath}/resources/angular/node_modules/reflect-metadata/Reflect.js"></script>
<script src="${pageContext.request.contextPath}/resources/angular/node_modules/systemjs/dist/system.src.js"></script>
<!-- 2. Configure SystemJS -->
<script src="${pageContext.request.contextPath}/resources/angular/systemjs.config.js"></script>
<script>
System.import('${pageContext.request.contextPath}/resources/angular/app').catch(function(err){ console.error(err); });
</script>
我已经按照angular 2快速入门了
https://angular.io/guide/quickstart
所有文件都包含上述链接中提到的相同代码。我唯一改变的是: 将 app 目录、node_modules 目录和配置文件复制到资源目录并修改 index.jsp 以从那里加载。
它抛出以下异常:
在浏览器控制台中获取http://localhost:8085/Phoenix/resources/angular/app/ 404(未找到)。请提出任何解决此问题的建议。
【问题讨论】:
-
检查my answer是否有类似问题。
标签: java angularjs spring-mvc angular