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

iwebkit Plugin

  • Tags: iphone
  • Latest: 0.5
  • Last Updated: 21 August 2010
  • Grails version: 1.3.4 > *
  • Authors: null
1 vote
compile "org.grails.plugins:iwebkit:0.5"




grails install-plugin iwebkit



Author : Sébastien Blanc

This plugin provides integration with iWebkit, a powerful User Interface Library for Safari development on iPhone. By using this plugin, the grails developer will not only have an iphone web app skeleton (CSS and javascript) but also an extended tag library helping in creating iphone web pages in an easy,clean and fast way.

Version 0.4 release notes:

  • iWebkit 5.0.4
Warning these are breaking changes :
  • Removed Geolocation feature , iwebkit has now a dependency on the geolocation plugin
  • Renamed namespace , the taglib is now under the namespace 'iwebkit' instead of 'iphone'
  • Renamed layout, the plugin layout is now called 'iwebkit.gsp' instead of 'iphone.gsp'



grails install-plugin iwebkit


After the plugin has been installed, just set the "iwebkit" layout :

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <meta name="layout" content="iwebkit" />
    <title>Note List</title>



Scaffolding is a feature that I really like with grails so I decided to provide the same thing for the plugin. That means that you will be able to build a complete mobile website in less than 60 seconds :

grails create-app bookstore
grails install-plugin iwebkit
grails install-iwebkit-templates

create a domain class :

grails create-domain class book
class Book {
String name
String icon

grails generate-all

add some test data to your bootstrap

new Book(name:'Grails in action',icon:'/bookstore/images/grails.png').save();
new Book(name:'Groovy in action',icon:'/bookstore/images/groovy.png').save();

Run the application, that's it !

TagLib - namespace 'iwebkit'


This will render the topbar of your webpage, a topbar can contain a title and navigation items.

attributes :

  • title


attributes :

  • navtype : "arrow" or "button"


attributes :

  • navtype : "arrow" or "button"


leftnavigation and rightnavigation contains navelement

atttributes :

  • action : maps to the controller action
  • controller (optional) :specify a controller
  • content : label of the navigation element
  • image : link to image path




attributes : *header : header label of this textbox


This will render an "Iphoned" html list. The list tag supports the following attributes:

  • action : maps to the controller action
  • controller (optional) :specify a controller
  • descriptionField : String attribute that will be used as label
  • imageField (optional) : path to associated image
  • list: bean reference of the list
  • customid (optional): useful for transient objects

Form support

Basically all the tags that you can use with grails core tag library are also available with the namespace "iphone" (i.e <iphone:submit/>). I got some issues with the select tag so this one is not available, but if you surround your regular g:select tag with the <iphone:section> tag it will works as wel.

Orientation support

You can now use "untouchable links", that means that you can bind a link/action to a specific orientation of your iphone (portrait mode, landscape mode). Basically , it works the same way as the g:createLink, you just have to pass an extra parameter "value" wich contains the angle of your phone :

   <iwebkit:angle value="90" action="addComment" id="${}"/>

But sometimes you don' t want to link to another page but you just want to update a html element of your current page, well that is also possible just pass this extra parameter "remote='true'" and also the id of the html element you want to update by using the "update' parameter. Basically with remote on true this tag works like the g:remoteLink tag :

   <iwebkit:angle value="90" remote="true" update="tweetTimeline" action="updateTimeline" id="${}" />

<div id="tweetTimeline"> … </div>



  • value: angle of your phone (90 : landscape left, -90:landscape right, 0: portrait)
  • action : maps to the controller action
  • controller (optional) :specify a controller
  • id(optional) : id of your bean
  • remote(optional): set this on true if you want to use ajax and update a html element of the current page
  • customid : useful for not persisted objects

Geolocation support

Iwebkit depends on the geolocation plugin

Always dreamed to add location based services to your web application. Well that sounds a bit complicated to add this feature. Well with iwebkit plugin adding LBS to your site is as difficult as adding this tag in your page :


You're done, your application is now aware of your current location. What happens ? Well this tag encapsulates some javascript that can access the geolocation API, convert the result to a JSON string and send it to the geolocationcontroller. The controller will create a Geolocation Domain object and put it in the session.

The Geolocation domain class implements the official W3C's geolocation specifications , so it's pretty easy to use/mashup this object with external services/libraries.

The plugin also comes with an action called "showMap" (/geolocation/showMap) that will retrieve your location from the session and show it on a google map. The main purpose of this page is to provide a sample on how you use your location object, use it as a starting point for your own implementations.