Search code examples
templatesgrailsgroovy

grails template Method code is too large error?


if Grails Template size is too big and using more g:tags than it fails to compile by template engine raise an error Method code is too large ?


Solution

  • if the template size is too large and having an error method code is too large and multiple compilation error in your gsp run than divide the _form template in to the multiple template like for example if form have multiple section in body for example application details,candidate details, experience, reason to change, etc than create like

    devide the form code (_form.gsp)

    _candidate.gsp
    _experience.gsp 
    _reasonToChange.gsp 
    

    now the actual code is like inside the form template _form.gsp

    <g:render template="candidate"></g:render>
    <g:render template="experience"></g:render>
    <g:render template="reasonToChange"></g:render>
    

    now if you render the _form than complete form is render and having no problem in compilation and no error

    in create.gsp you only render the form template

            <g:render template="form"/> 
    

    Thank You !!!