Can layouts be chosen by Grails controllers?
        Posted  
        
            by maerics
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by maerics
        
        
        
        Published on 2010-04-07T21:40:26Z
        Indexed on 
            2010/04/07
            21:43 UTC
        
        
        Read the original article
        Hit count: 256
        
I'm building a CMS as a learning exercise in Grails and would like to give content managers the ability to choose between different HTML page structures (e.g. 2 column, 3 column, etc).
Grails Layouts seem like a logical choice but is it possible for a Grails controller to explicitly name which layout will be used for rendering?  Ideally there would be a layout option to the render method, per Ruby on Rails but I don't see anything like it.
It seems like it might be possible using the applyLayout method by passing the name of the layout but this requires each GSP page to explicitly request layout (annoying overhead per-page) rather than using Layout by Convention.
Any ideas?
© Stack Overflow or respective owner