Angular 5 - 使用 jsp 和 Angular cli 失败
Angular 5 - Using jsp with Angular cli fails
我正在使用带有 angular cli 的 Angular5。我已将入口点作为我的 jsp 页面提供,其中包含 scriptlet 标记。当我构建它时,出现错误
子编译失败:模块构建失败:语法错误:无效或意外的标记。
这是我的 angular-cli.json
的示例
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"project": {
"name": "sample"
},
"apps": [
{
"root": "src/main/webapp/app",
"outDir": "src/main/webapp/dist",
"assets": [
"assets",
"favicon.ico"
],
"index": "index.jsp",
"main": "main.ts"
}
}
是否可以将入口点更改为 jsp 页面?如果是应该如何引用?
我遇到了类似的问题,并通过使用 JSP 包装由 Angular 应用程序生成的 index.html 来想出一个解决方法。
所以我的 angular-cli.json 看起来像这样
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"project": {
"name": "sample"
},
"apps": [
{
"root": "src/main/webapp/app",
"outDir": "src/main/webapp/jsp/myapp/files",
"assets": [
"assets",
"favicon.ico"
],
"index": "index.html",
"main": "main.ts"
}
]
}
然后我创建了src/main/webapp/jsp/myapp/index.jsp。我的 index.jsp 看起来像这样
<!doctype html>
<html>
<head>
<title>My App</title>
<base href="/jsp/myapp/">
</head>
<body>
<jsp:include page="files/index.html"/>
</body>
</html>
然后您可以通过点击 /jsp/myapp/ 或 /jsp/myapp/index.jsp 来启动您的应用程序。
希望对您有所帮助。
我正在使用带有 angular cli 的 Angular5。我已将入口点作为我的 jsp 页面提供,其中包含 scriptlet 标记。当我构建它时,出现错误
子编译失败:模块构建失败:语法错误:无效或意外的标记。
这是我的 angular-cli.json
的示例{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"project": {
"name": "sample"
},
"apps": [
{
"root": "src/main/webapp/app",
"outDir": "src/main/webapp/dist",
"assets": [
"assets",
"favicon.ico"
],
"index": "index.jsp",
"main": "main.ts"
}
}
是否可以将入口点更改为 jsp 页面?如果是应该如何引用?
我遇到了类似的问题,并通过使用 JSP 包装由 Angular 应用程序生成的 index.html 来想出一个解决方法。
所以我的 angular-cli.json 看起来像这样
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"project": {
"name": "sample"
},
"apps": [
{
"root": "src/main/webapp/app",
"outDir": "src/main/webapp/jsp/myapp/files",
"assets": [
"assets",
"favicon.ico"
],
"index": "index.html",
"main": "main.ts"
}
]
}
然后我创建了src/main/webapp/jsp/myapp/index.jsp。我的 index.jsp 看起来像这样
<!doctype html>
<html>
<head>
<title>My App</title>
<base href="/jsp/myapp/">
</head>
<body>
<jsp:include page="files/index.html"/>
</body>
</html>
然后您可以通过点击 /jsp/myapp/ 或 /jsp/myapp/index.jsp 来启动您的应用程序。
希望对您有所帮助。