controller.metaClass.renderForBrand = {Map args - > def viewName = args.view}无法在grails 2.2.1中工作?

时间:2013-09-26 12:48:33

标签: grails bootstrapping grails-2.2

在grails 2.2.1 controller.metaClass.renderForBrand()中没有获取视图和模板名称.. 这是代码:

 controller.metaClass.renderForBrand = { Map args ->
                def viewName = args.view
                def templateName = args.template
                def controllerName = args.controller ?: groovyPagesUriService.getLogicalControllerName(delegate)

                if(args.view || args.template){
                    //add the following info to model to display: brand, delegate controller, gsp name, instanceid, and environment (only for gsps)
                    def instanceId = System.getProperty("com.j2.property.instanceid")
                    def environment = Environment.getCurrent()
                    def gsp = args.view ?: args.template
                    def model = args.model ?: [:]
                    model.debugInfo = [instanceId:instanceId, environment:environment, gsp:gsp, delegateController:controllerName]
                    args.model = model
                }
    originalRenderMethod.invoke(delegate, args)
        }   

这里控制器没有进入地图的侧循环而没有获取视图名称和模板名称。

0 个答案:

没有答案