Grails 初始化GroovyPageView时出错
我使用的是Grails 初始化GroovyPageView时出错,grails,grails-2.0,Grails,Grails 2.0,我使用的是grails2.3.4。当我加载index.gsp页面时,我得到: | Server running. Browse to http://localhost:8080/testApplication | Application loaded in interactive mode. Type 'stop-app' to shutdown. | Enter a script name to run. Use TAB for completion: ....[/testApplicatio
grails2.3.4
。当我加载index.gsp页面时,我得到:
| Server running. Browse to http://localhost:8080/testApplication
| Application loaded in interactive mode. Type 'stop-app' to shutdown.
| Enter a script name to run. Use TAB for completion:
....[/testApplication].[gsp] Servlet.service() for servlet [gsp] in context w
ith path [/testApplication] threw exception
org.codehaus.groovy.grails.web.mapping.exceptions.UrlMappingException: Error map
ping onto view [/index]: Error initializing GroovyPageView
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.
java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
.java:615)
at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.RuntimeException: Error initializing GroovyPageView
... 3 more
Caused by: org.codehaus.groovy.grails.web.taglib.exceptions.GrailsTagException:
Expecting '=' after attribute name (ng-app).
... 3 more
[/testApplication].[gsp] Servlet.service() for servlet [gsp] in context with
path [/testApplication] threw exception
org.codehaus.groovy.grails.web.mapping.exceptions.UrlMappingException: Error map
ping onto view [/index]: Error initializing GroovyPageView
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.
java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
.java:615)
at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.RuntimeException: Error initializing GroovyPageView
... 3 more
Caused by: org.codehaus.groovy.grails.web.taglib.exceptions.GrailsTagException:
Expecting '=' after attribute name (ng-app).
... 3 more
[/testApplication].[gsp] Servlet.service() for servlet [gsp] in context with
path [/testApplication] threw exception
org.codehaus.groovy.grails.web.mapping.exceptions.UrlMappingException: Error map
ping onto view [/index]: Error initializing GroovyPageView
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.
java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
.java:615)
at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.RuntimeException: Error initializing GroovyPageView
... 3 more
Caused by: org.codehaus.groovy.grails.web.taglib.exceptions.GrailsTagException:
Expecting '=' after attribute name (ng-app).
... 3 more
我的index.gsp
看起来很简单:
<head ng-app>
<meta name="layout" content="main" />
<title>Title Page</title>
<!-- here we are loading angularjs -->
<r:require module="angular" />
</head>
<body>
<div>
<div>Hello World!</div>
<p>Nothing here {{'yet' + '!'}}</p>
<p>1 + 2 = {{ 1 + 2 }}</p>
</div>
</body>
为什么会出现这个错误?
我真的很感激你的回答
更新
我的ApplicationResources.groovy
文件:
modules = {
'angular' {
resource url:'/js/lib/angular-1.2.8/angular.min.js'
resource url:'/js/lib/angular-1.2.8/angular-resource.min.js'
println "Loading libs"
}
}
这是我的文件夹结构:
上面写着例外
属性名后应为“=”(ng app)。
为什么要将“ng app”放在“head”标签中?
尝试删除它。谢谢您的回答!但是,将其放入我的
中并不使用angularjs。我只得到了普通的html输出
,它不是由angularjs
呈现的。试着把ng应用程序放到你的html标签上。检查angular.js是否正确加载。我猜js加载有一些问题。您是否在ApplicationResources.groovy中定义了angular模块?是否正确?并将ApplicationResources文件的内容放入question@AramArabyan请看我的更新!也尝试过这个,但它提供了与以前相同的结果。。。
modules = {
'angular' {
resource url:'/js/lib/angular-1.2.8/angular.min.js'
resource url:'/js/lib/angular-1.2.8/angular-resource.min.js'
println "Loading libs"
}
}