How to include jquery.js in Grails?

后端 未结 10 2150
北海茫月
北海茫月 2021-02-05 06:50

I have a Grails 2.0.0 project that was created using grails create-app. In my HTML and GSP files, I\'m trying to include jquery.js. I\'ve tried all of

10条回答
  •  无人共我
    2021-02-05 07:31

    I saw a good tutorial on that in icodeya. http://www.icodeya.com/2012/09/grails-different-ways-to-import.html

    you can either do this in your gsp:

    
    

    OR you can do this in your Config.groovy:

    grails.resources.modules = {
    core{
    resource url:'/js/jQuery.js' 
    } 
    myScript { 
    resource url:'/js/myScript.js' 
    dependsOn 'core' 
    }
    }
    

    then, in your gsp, you can attach this:

    
    

提交回复
热议问题