0

我正在做一个 grails 项目。所以在它的主布局页面中有一个字符串

 <title>CHP: <g:layoutTitle /></title>

每个视图页面都有一个标题标签。但是我发现在 HelperMethodsTagLib (在同一个命名空间内)中,layoutTitle 标记被覆盖:

def layoutTitle = { attrs, body ->
        try {
            out << this.pageScope.settedPageTitle
        } catch (Exception e) {
            out << "Default"
        }
    }

此实现不起作用,因此每个页面都有标题 CHP:默认值。删除此实现会导致应用程序出现以下问题:

 2012-08-30 20:53:40,580 [http-8080-2] ERROR chp.HomeController  - org.codehaus.groovy.grails.web.errors.GrailsWrappedRuntimeException
2012-08-30 20:53:40,591 [http-8080-2] ERROR pages.GroovyPagesServlet  - Error processing GSP: Error executing tag <g:layoutTitle>: java.lang.StackOverflowError at /home/aggressor/Job/chp/trunk/grails-app/views/layouts/user_page.gsp:5
org.codehaus.groovy.grails.web.taglib.exceptions.GrailsTagException: Error executing tag <g:layoutTitle>: java.lang.StackOverflowError at /home/aggressor/Job/chp/trunk/grails-app/views/layouts/user_page.gsp:5
    at home_aggressor_Job_chp_trunk_grails_app_views_layouts_user_page_gsp$_run_closure1_closure3.doCall(home_aggressor_Job_chp_trunk_grails_app_views_layouts_user_page_gsp:23)
    at home_aggressor_Job_chp_trunk_grails_app_views_layouts_user_page_gsp$_run_closure1_closure3.doCall(home_aggressor_Job_chp_trunk_grails_app_views_layouts_user_page_gsp)
    at home_aggressor_Job_chp_trunk_grails_app_views_layouts_user_page_gsp$_run_closure1.doCall(home_aggressor_Job_chp_trunk_grails_app_views_layouts_user_page_gsp:25)
    at home_aggressor_Job_chp_trunk_grails_app_views_layouts_user_page_gsp$_run_closure1.doCall(home_aggressor_Job_chp_trunk_grails_app_views_layouts_user_page_gsp)
    at home_aggressor_Job_chp_trunk_grails_app_views_layouts_user_page_gsp.run(home_aggressor_Job_chp_trunk_grails_app_views_layouts_user_page_gsp:40)
    at java.lang.Thread.run(Thread.java:722)
Caused by: org.codehaus.groovy.runtime.InvokerInvocationException: java.lang.StackOverflowError
    at chp.HelperMethodsTagLib.getProperty(chp.HelperMethodsTagLib)
    ... 6 more
Caused by: java.lang.StackOverflowError
    at chp.HelperMethodsTagLib.getProperty(chp.HelperMethodsTagLib)
    at chp.HelperMethodsTagLib.getProperty(chp.HelperMethodsTagLib)
    at chp.HelperMethodsTagLib.getProperty(chp.HelperMethodsTagLib)
    at chp.HelperMethodsTagLib.getProperty(chp.HelperMethodsTagLib)
    at chp.HelperMethodsTagLib.getProperty(chp.HelperMethodsTagLib)
    at chp.HelperMethodsTagLib.getProperty(chp.HelperMethodsTagLib)
    at chp.HelperMethodsTagLib.getProperty(chp.HelperMethodsTagLib)
    at chp.HelperMethodsTagLib.getProperty(chp.HelperMethodsTagLib)
    at chp.HelperMethodsTagLib.getProperty(chp.HelperMethodsTagLib)
    at chp.HelperMethodsTagLib.getProperty(chp.HelperMethodsTagLib)
    at chp.HelperMethodsTagLib.getProperty(chp.HelperMethodsTagLib)
    at chp.HelperMethodsTagLib.getProperty(chp.HelperMethodsTagLib)
    at chp.HelperMethodsTagLib.getProperty(chp.HelperMethodsTagLib)
    at chp.HelperMethodsTagLib.getProperty(chp.HelperMethodsTagLib)
    at chp.HelperMethodsTagLib.getProperty(chp.HelperMethodsTagLib)
    at chp.HelperMethodsTagLib.getProperty(chp.HelperMethodsTagLib)
    at chp.HelperMethodsTagLib.getProperty(chp.HelperMethodsTagLib)
    at chp.HelperMethodsTagLib.getProperty(chp.HelperMethodsTagLib)
    at chp.HelperMethodsTagLib.getProperty(chp.HelperMethodsTagLib)
    at chp.HelperMethodsTagLib.getProperty(chp.HelperMethodsTagLib)
    at chp.HelperMethodsTagLib.getProperty(chp.HelperMethodsTagLib)
    at chp.HelperMethodsTagLib.getProperty(chp.HelperMethodsTagLib)
    at chp.HelperMethodsTagLib.getProperty(chp.HelperMethodsTagLib)
    at chp.HelperMethodsTagLib.getProperty(chp.HelperMethodsTagLib)
    at chp.HelperMethodsTagLib.getProperty(chp.HelperMethodsTagLib)
    at chp.HelperMethodsTagLib.getProperty(chp.HelperMethodsTagLib)
    at chp.HelperMethodsTagLib.getProperty(chp.HelperMethodsTagLib)
    at chp.HelperMethodsTagLib.getProperty(chp.HelperMethodsTagLib)
    at chp.HelperMethodsTagLib.getProperty(chp.HelperMethodsTagLib)
    at chp.HelperMethodsTagLib.getProperty(chp.HelperMethodsTagLib)
    at chp.HelperMethodsTagLib.getProperty(chp.HelperMethodsTagLib)
    at chp.HelperMethodsTagLib.getProperty(chp.HelperMethodsTagLib)
    at chp.HelperMethodsTagLib.getProperty(chp.HelperMethodsTagLib)
    at chp.HelperMethodsTagLib.getProperty(chp.HelperMethodsTagLib)
    at chp.HelperMethodsTagLib.getProperty(chp.HelperMethodsTagLib)
    at chp.HelperMethodsTagLib.getProperty(chp.HelperMethodsTagLib)
    at chp.HelperMethodsTagLib.getProperty(chp.HelperMethodsTagLib)
    at chp.HelperMethodsTagLib.getProperty(chp.HelperMethodsTagLib)
    at chp.HelperMethodsTagLib.getProperty(chp.HelperMethodsTagLib)
    at chp.HelperMethodsTagLib.getProperty(chp.HelperMethodsTagLib)
    at chp.HelperMethodsTagLib.getProperty(chp.HelperMethodsTagLib)
    at chp.HelperMethodsTagLib.getProperty(chp.HelperMethodsTagLib)
    at chp.HelperMethodsTagLib.getProperty(chp.HelperMethodsTagLib)
    at chp.HelperMethodsTagLib.getProperty(chp.HelperMethodsTagLib)
    at chp.HelperMethodsTagLib.getProperty(chp.HelperMethodsTagLib)
    at chp.HelperMethodsTagLib.getProperty(chp.HelperMethodsTagLib)
    at chp.HelperMethodsTagLib.getProperty(chp.HelperMethodsTagLib)
    at chp.HelperMethodsTagLib.getProperty(chp.HelperMethodsTagLib)
    at chp.HelperMethodsTagLib.getProperty(chp.HelperMethodsTagLib)
    at chp.HelperMethodsTagLib.getProperty(chp.HelperMethodsTagLib)
    at chp.HelperMethodsTagLib.getProperty(chp.HelperMethodsTagLib)
    at chp.HelperMethodsTagLib.getProperty(chp.HelperMethodsTagLib)
    at chp.HelperMethodsTagLib.getProperty(chp.HelperMethodsTagLib)
    at chp.HelperMethodsTagLib.getProperty(chp.HelperMethodsTagLib)
    at chp.HelperMethodsTagLib.getProperty(chp.HelperMethodsTagLib)
    at chp.HelperMethodsTagLib.getProperty(chp.HelperMethodsTagLib)
    at chp.HelperMethodsTagLib.getProperty(chp.HelperMethodsTagLib)
    at chp.HelperMethodsTagLib.getProperty(chp.HelperMethodsTagLib)
    at chp.HelperMethodsTagLib.getProperty(chp.HelperMethodsTagLib)
    at chp.HelperMethodsTagLib.getProperty(chp.HelperMethodsTagLib)
    at chp.HelperMethodsTagLib.getProperty(chp.HelperMethodsTagLib)
    at chp.HelperMethodsTagLib.getProperty(chp.HelperMethodsTagLib)
    at chp.HelperMethodsTagLib.getProperty(chp.HelperMethodsTagLib)
    at chp.HelperMethodsTagLib.getProperty(chp.HelperMethodsTagLib)
    at chp.HelperMethodsTagLib.getProperty(chp.HelperMethodsTagLib)
    at chp.HelperMethodsTagLib.getProperty(chp.HelperMethodsTagLib)
    at chp.HelperMethodsTagLib.getProperty(chp.HelperMethodsTagLib)
4

0 回答 0