0
下面是GSP模板解析方法創建:那我收到NullPointerException異常閱讀GSP模板
String renderGSPTemplate(String templateText, Map bindings){
def output = new StringWriter()
String pageName = bindings.remove('pageName')
groovyPagesTemplateEngine.clearPageCache()
Template template1 = groovyPagesTemplateEngine.createTemplate(templateText, pageName)
Writable data = template1.make(bindings)
data.writeTo(output)
return output
}
以下是例外:
Error java.lang.NullPointerException
| Error at org.codehaus.groovy.grails.web.pages.GroovyPageOutputStack.lookupStack(GroovyPageOutputStack.java:102)
| Error at org.codehaus.groovy.grails.web.pages.GroovyPageOutputStack.currentStack(GroovyPageOutputStack.java:76)
| Error at org.codehaus.groovy.grails.web.pages.GroovyPage.initRun(GroovyPage.java:213)
| Error at org.codehaus.groovy.grails.web.pages.GroovyPageWritable.doWriteTo(GroovyPageWritable.java:199)
| Error at org.codehaus.groovy.grails.web.pages.GroovyPageWritable.writeTo(GroovyPageWritable.java:128)
| Error at groovy.lang.Writable$writeTo.call(Unknown Source)
| Error at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
| Error at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
| Error at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
| Error at com.verecloud.nimbus4.mail.TemplateParserService$$EPpsYO6i.renderGSPTemplate(TemplateParserService.groovy:37)
任何人知道這個錯誤的原因。
謝謝!
請告訴我哪一行是行37 –