freemarker在grails中的隐藏变量
1.假设你用以下地址访问系统:
http://www.abc.com/html/aboutLaw?name=cat&age=20
?
很明显是渲染了aboutLaw.ftl这个页面。如果要在aboutLaw.ftl中直接使用传来的参数name和age,要怎么用呢?
很简单,用以下变量:
?
?
key:javax.servlet.forward.request_urivalue:/html/aboutLaw--------------------- key:javax.servlet.forward.context_pathvalue:--------------------- key:javax.servlet.forward.servlet_pathvalue:/html/aboutLaw--------------------- key:aboutFeevalue:controller.HtmlController$_closure4@3b889b--------------------- key:managervalue:manager.Manager@793ec9--------------------- key:org.springframework.web.servlet.DispatcherServlet.THEME_SOURCEvalue:org.codehaus.groovy.grails.commons.spring.GrailsWebApplicationContext@1f39cb2: startup date [Tue Nov 08 09:21:17 CST 2011]; parent: Root WebApplicationContext--------------------- key:org.springframework.web.servlet.DispatcherServlet.THEME_RESOLVERvalue:org.springframework.web.servlet.theme.FixedThemeResolver@5e67f1--------------------- key:springMacroRequestContextvalue:org.springframework.web.servlet.support.RequestContext@857f69--------------------- key:metaClassvalue:groovy.lang.ExpandoMetaClass@359912[class controller.HtmlController]--------------------- key:aboutUsvalue:controller.HtmlController$_closure5@6ffb14--------------------- key:helpvalue:controller.HtmlController$_closure6@1cd022c--------------------- key:org.codehaus.groovy.grails.GRAILS_APPLICATION_ATTRIBUTESvalue:org.codehaus.groovy.grails.web.servlet.DefaultGrailsApplicationAttributes@49c8dd--------------------- key:urlMapping.FILTEREDvalue:--------------------- key:charEncodingFilter.FILTEREDvalue:--------------------- key:ctxvalue:org.codehaus.groovy.grails.commons.spring.GrailsWebApplicationContext@1f39cb2: startup date [Tue Nov 08 09:21:17 CST 2011]; parent: Root WebApplicationContext--------------------- key:org.codehaus.groovy.grails.CONTROLLER_NAME_ATTRIBUTEvalue:html--------------------- key:grailsAppvalue:org.codehaus.groovy.grails.commons.DefaultGrailsApplication@11aed03--------------------- key:org.codehaus.groovy.grails.CONTROLLERvalue:controller.HtmlController@22537a--------------------- key:hiddenHttpMethod.FILTEREDvalue:--------------------- key:grailsWebRequest.FILTEREDvalue:--------------------- key:org.springframework.web.servlet.DispatcherServlet.CONTEXTvalue:org.codehaus.groovy.grails.commons.spring.GrailsWebApplicationContext@1f39cb2: startup date [Tue Nov 08 09:21:17 CST 2011]; parent: Root WebApplicationContext--------------------- key:aboutLawvalue:controller.HtmlController$_closure2@1968017--------------------- key:aboutYuanlivalue:controller.HtmlController$_closure3@1b3a564--------------------- key:classvalue:class controller.HtmlController--------------------- key:org.codehaus.grails.INCLUDED_JS_LIBRARIESvalue:--------------------- key:gotoHtmlvalue:controller.HtmlController$_closure1@12f7431--------------------- key:getPagevalue:controller.BaseController$_closure1@753f9f--------------------- key:org.codehaus.groovy.grails.ACTION_NAME_ATTRIBUTEvalue:aboutLaw--------------------- key:org.codehaus.groovy.grails.web.sitemesh.GrailsPageFilter.GSP_SITEMESH_PAGEvalue:org.codehaus.groovy.grails.web.sitemesh.GSPSitemeshPage@1a41860--------------------- key:reloadFilter.FILTEREDvalue:--------------------- key:com.opensymphony.sitemesh.APPLIED_ONCEvalue:--------------------- key:sysParaServicevalue:service.SysParaService@6231ed--------------------- key:dayvalue:86400--------------------- key:org.codehaus.groovy.grails.WEB_REQUESTvalue:ServletWebRequest: uri=/grails/html/aboutLaw.dispatch;client=127.0.0.1;session=D0849CBBEA6B59B4B7A0653BBF363064--------------------- key:org.springframework.web.servlet.DispatcherServlet.LOCALE_RESOLVERvalue:org.springframework.web.servlet.i18n.SessionLocaleResolver@44899b
?其中的javax.servlet.forward.request_uri很有用。