Angular 5-将jsp与Angular cli一起使用失败
我将Angular5与AngularCLI一起使用。我已经将我的入口点作为包含scriptlet标记的jsp页面提供。当我构建这个时,我得到的错误是 子编译失败:模块生成失败:语法错误:无效或意外标记 下面是我的angular-cli.json示例Angular 5-将jsp与Angular cli一起使用失败,jsp,angular-cli,angular5,Jsp,Angular Cli,Angular5,我将Angular5与AngularCLI一起使用。我已经将我的入口点作为包含scriptlet标记的jsp页面提供。当我构建这个时,我得到的错误是 子编译失败:模块生成失败:语法错误:无效或意外标记 下面是我的angular-cli.json示例 { "$schema": "./node_modules/@angular/cli/lib/config/schema.json", "project": { "name": "sample" }, "apps": [
{
"$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"
}
]
}
<!doctype html>
<html>
<head>
<title>My App</title>
<base href="/jsp/myapp/">
</head>
<body>
<jsp:include page="files/index.html"/>
</body>
</html>
然后我创建了src/main/webapp/jsp/myapp/index.jsp。我的index.jsp如下所示
{
"$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"
}
]
}
<!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来启动应用程序
希望能有帮助