2014-10-08 112 views
0

我有一個名爲TestPlugin的插件,它提供了一個名爲_test-include.gspgrails-app/views中包含的GSP。我進口TestPluginTestApp,並試圖使它像這樣:Grails無法從插件渲染GSP

<g:render template="_test-include" plugin="${applicationContext.getBean('pluginManager').getGrailsPlugin('testPlugin')}"/> 

我也試過這樣:

<g:render template="_test-include" plugin="testPlugin"/> 

兩個結果在拋出異常。以下是來自Grails的錯誤報告:

Message: Error mapping onto view [/index]: Error processing GroovyPageView: Error executing tag <g:render>: null 
    Line | Method 
->> 1142 | runWorker in java.util.concurrent.ThreadPoolExecutor 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
| 617 | run  in java.util.concurrent.ThreadPoolExecutor$Worker 
^ 745 | run . . . in java.lang.Thread 
Caused by GroovyPagesException: Error processing GroovyPageView: Error executing tag <g:render>: null 
->> 527 | runWorker in C:\temp\grails-test\test-app\grails-app\views\index.gsp 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Caused by GrailsTagException: Error executing tag <g:render>: null 
->> 113 | doCall in C:/temp/grails-test/test-app/grails-app/views/index.gsp 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Caused by NullPointerException: null 
->> 936 | get  in java.util.concurrent.ConcurrentHashMap 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
| 141 | getValue in grails.util.CacheEntry 
|  81 | getValue in  '' 
|  58 | doCall in C__temp_grails_test_test_app_grails_app_views_index_gsp$_run_closure2 
|  70 | run . . . in C__temp_grails_test_test_app_grails_app_views_index_gsp 
| 1142 | runWorker in java.util.concurrent.ThreadPoolExecutor 
| 617 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker 
^ 745 | run  in java.lang.Thread 

回答

2

不會呈現以_開頭的模板。

這應該工作:

<g:render template="/test-include" plugin="testPlugin"/>