我正在使用Angular5与Angular CLI。我提供了我的入口点为我的JSP页面,其中包含Scriptlet标签。当我构建这个时,我会遇到错误,为
儿童汇编失败:模块构建失败:SyntaxError:无效或意外令牌。
这是我的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包装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/or/jsp/myapp/index.jsp。
启动应用程序希望它有帮助。