简体   繁体   中英

Grails: Get the View name in the Layout GSP

With Grails, is it possible to get the name of the view that is being rendered while in the layout GSP file? I'd like to change one minor thing in the layout file depending on which view is going to be rendered.

视图的名称通常与刚刚执行的动作相同(例如, show action通常会呈现show.gsp视图)-如果您的视图属于这种情况,则可以使用${actionName}在布局gsp中获取它。 ${actionName}

If found this to be rather difficult to determine. It's easy if you use conventions, but you can always explicitly render any view you want. See the code in How to detect which view file has been rendered in grails for how to determine this in a filter.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM