Grails plugin integrating the Prototype, Scriptaculous and Rico Javascript libraries
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Prototype Grails Plugin

This plugin integrates the Prototype, Scriptaculous and Rico Javascript libraries into Grails. In Grails versions prior to 1.4 these libraries were included by default in Grails. As of Grails 1.4 jQuery is the default Javascript library in the Grails distribution with this plugin providing an alternative for those who would rather use Prototype or want to upgrade an existing Grails application that uses Prototype based script.

Using the plugin

In order to use Prototype rather than jQuery in a Grails app you just need to:

grails uninstall-plugin jquery
grails install-plugin prototype

Including libraries

The plugin provides three Javascript libraries, prototype, scriptaculous and rico. The scriptaculous and rico libraries depend on prototype so if you are including either of those it is not necessary to include prototype separately.

For example:

<g:javascript plugin="prototype" library="scriptaculous"/>

Will be converted to:

<script type="text/javascript" src="/myapp/plugins/prototype-1.0-SNAPSHOT/js/prototype/prototype.js"></script>
<script type="text/javascript" src="/myapp/plugins/prototype-1.0-SNAPSHOT/js/prototype/scriptaculous.js"></script>

Using the Resources plugin

If you are using the Resources plugin you can include Prototype libraries that way. e.g.:

<r:require module="scriptaculous"/>

Using Grails' AJAX tags

In order to have Grails' built-in AJAX tags such as g:formRemote and g:remoteLink to generate Prototype code you need to add the following declaration to your GSP:

<g:setProvider library="prototype"/>