Reputation: 707
For about 3 months I learn Grails and I developed my first full application alone. I deployed it on a tomcat server (Tomcat6). For that I use grails war first and then I put myApplic.war in the tomcat's webapps directory. The application is correctly deployed BUT in my page the autocomplete from JQUery-UI doesn't work at the moment (in development it works well). I used the JQuery and JQuery-UI plugins (I added them in my BuildConfig.groovy) and when I display the source code of my page I got something like that :
<script src="/CoiffureV2-0.1/static/plugins/jquery-1.8.3/js/jquery/jquery-1.8.3.min.js" type="text/javascript" ></script>
<link href="/CoiffureV2-0.1/static/plugins/jquery-ui-1.8.24/jquery-ui/themes/ui-lightness/jquery-ui-1.8.24.custom.css" type="text/css" rel="stylesheet" media="screen, projection" />
<script src="/CoiffureV2-0.1/static/plugins/jquery-ui-1.8.24/jquery-ui/js/jquery-ui-1.8.24.custom.min.js" type="text/javascript" ></script>
<link href="/CoiffureV2-0.1/static/plugins/twitter-bootstrap-2.3.2/less/bootstrap.less.css" type="text/css" media="screen, projection" rel="stylesheet" order="100" />
So it seems that JQuery is correctly included. What can I do to solve my problem ? Any idea ?
Thanks in advance,
Best regards,
Hito
Upvotes: 0
Views: 1320
Reputation: 56
Install the resources program if it's not already in your project. Then, you have two options:
This is the case if your .gsp page has something like <meta name="layout" content="main"/>
inside <head>
.
Add the following to the beginning of the <head>
section of individual .gsp pages that need JQuery and JQuery UI:
<r:require modules="jquery,jquery-ui"/>
Then, right before </head>
in main.gsp
add:
<r:layoutResources/>
Then right before </body>
in main.gsp
add:
<r:layoutResources/>
Remove your old <script>
and <link>
tags.
Put this inside <head>
on .gsp pages that need JQuery:
<r:require modules="jquery,jquery-ui"/>
<r:layoutResources/>
And put this right before </body>
<r:layoutResources/>
Remove your old <script>
and <link>
tags.
Example: http://pastebin.com/K0LU4sqG
Resources plugin documentation: http://grails.org/plugin/resources
Upvotes: 4