我已将<g:javascript library="bootstrap.js" />
放入index.gsp
我的ApplicationResources.groovy
:
modules = {
application {
resource url:'js/bootstrap.js'
}
}
然而我收到错误:
[http-bio-8080-exec-8] ERROR [/testApplication].[gsp] - Servlet.service() for servlet [gsp] in context with path [/testApplication] threw exception
Message: Error mapping onto view [/index]: Error processing GroovyPageView: Error executing tag <g:javascript>: No module found with name [bootstrap.js]
Line | Method
->> 53 | doFilter in grails.plugin.springsecurity.web.filter.GrailsAnonymousAuthenticationFilter
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 49 | doFilter in grails.plugin.springsecurity.web.authentication.RequestHolderAuthenticationFilter
| 82 | doFilter in grails.plugin.springsecurity.web.authentication.logout.MutableLogoutFilter
| 1110 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 603 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 722 | run in java.lang.Thread
Caused by GroovyPagesException: Error processing GroovyPageView: Error executing tag <g:javascript>: No module found with name [bootstrap.js]
->> 530 | doFilter in C:\Users\user\GrailsWorkspace\testApplication\grails-app\views\index.gsp
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Caused by GrailsTagException: Error executing tag <g:javascript>: No module found with name [bootstrap.js]
->> 150 | doCall in C:/Users/user/GrailsWorkspace/testApplication/grails-app/views/index.gsp
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Caused by IllegalArgumentException: No module found with name [bootstrap.js]
->> 1032 | getAllModuleNamesRequired in org.grails.plugin.resource.ResourceProcessor
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1091 | addModuleDispositionsToRequest in ''
| 144 | declareModuleRequiredByPage in org.grails.plugin.resource.ResourceTagLib
| 330 | doCall in org.grails.plugin.resource.ResourceTagLib$_closure5_closure20
| 326 | doCall . in org.grails.plugin.resource.ResourceTagLib$_closure5
| 150 | doCall in C__Users_user_GrailsWorkspace_testApplication_grails_app_views_index_gsp$_run_closure2
| 152 | run . . . in C__Users_user_GrailsWorkspace_testApplication_grails_app_views_index_gsp
| 53 | doFilter in grails.plugin.springsecurity.web.filter.GrailsAnonymousAuthenticationFilter
| 49 | doFilter in grails.plugin.springsecurity.web.authentication.RequestHolderAuthenticationFilter
| 82 | doFilter in grails.plugin.springsecurity.web.authentication.logout.MutableLogoutFilter
| 1110 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 603 | run in java.util.concurrent.ThreadPoolExecutor$Worker
^ 722 | run . . . in java.lang.Thread
我也试过grails clean
。但是它不会改变我的输出。
我非常感谢您对我的问题的回答
答案 0 :(得分:2)
请注意您已将其付诸实施
application {
resource url:'js/bootstrap.js'
}
<g:javascript library="application"/>
应该工作
或者将它放在您的ApplicationResource.groovy
中mydef {
resource url:'js/bootstrap.js'
}
并在您的gsp页面(或主布局页面)中
<g:javascript library="mydef"/>