Plugins You can find out about all the publicly available Grails plugins.

Javascript URL Mappings

  • Tags: javascript
  • Latest: 0.1.1
  • Last Updated: 05 August 2010
  • Grails version: 1.2.2 > *
  • Authors: null
1 vote
compile "org.grails.plugins:javascript-url-mappings:0.1.1"




grails install-plugin javascript-url-mappings


A Grails plugin to provide client-side reverse URL mappings outside of GSP files. Just put one taglib call in your layout and your static javascript files can make use of Grails' UrlMappings

Example usage (jQuery)

<!-- Place this tag in your layout's head element: -->
    <g:urlMappings />

<script type="text/javascript"> var url = g.createLink({controller: 'news', action: 'fetch', params: {since: new Date()}}); $('#myDiv').load(url);

var img = document.createElement('img'); img.src = g.resource({dir: 'images', file: 'icon.gif'});


More usage examples can be found in the javascript unit tests:

Current Status

Currently reverse-maps all controllers and actions, using the params controller , action , and optionally id . Supports building static resource URLs through use of the g.resource() function, using the params dir and file just like the built-in Grails taglib.

Recent Changes

  • 0.1.1 - Bugfix release, fixed bad template path
  • 0.1 - initial release


  • Get project under jvm-level test
  • Get project under functional test to test javascript from "grails test-app"
  • Add support for named mappings
  • Add support for mapping wildcards to reverse-map params (e.g. "controller/action?/id?")
  • Support the "url" attribute of createLink
  • Support absolute urls