grailsgrails-2.2

load jquery library in grails 2 is failing?


I was following the manual

https://grails.github.io/grails2-doc/2.2.0/guide/single.html#ajax

there it says to put the following tag in head section

<g:javascript library="jquery" />

I created a sample application and a test controller called HomeController. I created index page and put the above tag in the head. When i load the page it throws the following error.

enter image description here

I am finding the error difficult to comprehend. I appreciate any help. Thanks!


Solution

  • If your index page is not using any layout then make sure you have <r:layoutResources/> at the end of your head and body.

    And if using layout, then make sure you have <r:layoutResources/> in your layout gsp (at the end of head and body).