Wednesday, August 12, 2009

Grails - multiple layouts

Hi Friends,

The small project that I worked had many different layouts, like different for home and rest of the pages. So we generally make use of main.gsp to define the basic layout of the application which is common to all gsps. So to cater to different layouts issue, I created multiple(as required) gsps just like main.gsp in the layouts folder. And wherever a particular layout was needed corresponding gsp was included in the meta tag. For example

For home page layout - mainHome.gsp and referred it as < meta name="layout" content="mainHome"/ >

For admin page layout - mainAdmin.gsp and referred it as < meta name="layout" content="mainAdmin"/ > and like ways.

So this saved me from writing the same code again and again.

Cheers!
~~Amit Jain~~
amitjain1982@gmail.com

No comments:

Post a Comment