Last updated by 3 years ago

Page: ScaffoldTags Plugin, Version:8


This plugin provides an 'automatic' component-like rendering infrastructure to Grails. It combines the ease of use of scaffolding with the flexibility to change the resulting views via custom renderers. This also allows you to change what tags you use to render an object without having to worry about consistency across views. Write it once, and be done with it!

Note: We are working to update the plugin to Grails 1.1.1. The issue is being tracked in Jira


  • Automatically-updated views as you modify your domain class.
  • Renderers to support all of your views- not just your edit/create views.
  • Customizable views for any given data/domain/relationship type, either application-wide or on a per-controller level.
  • Render domain objects or beans on your GSP pages using a single tag call.
  • Inherit views through inheritance
  • Auto-link your list items, and create action renderers
  • Installable skins
Author: Daiji Takamori Plugin Site: (download and demo links available on this page) Plugin Package: Sample application: (out of date; using grails 0.4.2 and scaffoldtags 0.6) Submit a bug:


First time

To install the ScaffoldTags plugin type this command in your project's root folder:

grails install-plugin scaffold-tags
If you're modifying an existing application, backup any scaffolding templates you've already established now; you can use them later but you'll want to see how it looks first.
You'll then want to choose what type of scaffolding skin to use (HTML or Dojo).
grails install-skin

Upgrading an application from a previous release

First, remove the old plugin directory (grails-ScaffoldTags-0.6.2). Then install scaffold-tags. Move any existing custom ScaffoldTags skins from APPHOME/scaffold-skins to APPHOME/src/skins. Then go on with business as usual.

Quick-start Walkthrough

The following assumes you're using Grails 0.5.5+.
  1. Create an application and install scaffold-tags. For now, we're not going to use an AJAX UI.
grails create-app sample
cd sample
grails install-plugin scaffold-tags
grails install-skin no-img-skin
  1. Create a Book class.
grails create-domain-class Book
  1. Add a name property to the Book
class Book {
    String name
  1. Now generate your controller and views.
grails generate-all Book
  1. Run your app, and check out the various views. Looks kinda simple, right? Oops, we forgot to add a description to the book! Without stopping your app, let's add it (sample/grails-app/domain/Book.groovy).
class Book {
    String name
    String description
  1. Re-load your pages. The description field is added automatically. So what? We could've done this with regular scaffolding, right? Well, let's add more (don't stop running the app!). Create sample/grails-app/views/book/editor/java.lang.String.gsp and put in the following:
<textarea rows='5' cols='40' name='${name}'>${value?.encodeAsHTML()}</textarea>
or replace it with a rich text editor, if you have the FCKEditor installed in your app (see note below):
<g:richTextEditor basepath="js/fckeditor/" name='${name}' value="${value}" />
  1. Re-load those pages. Bet you couldn't do that with scaffolding! But wait! We only wanted to do that for the description field. Rename sample/grails-app/views/book/editor/java.lang.String.gsp to sample/grails-app/views/book/editor/Book.description.gsp.
  2. View that page again. We now only have the description field using the bigger field editor. Now if we were to want to change it for all controllers, you would place it under sample/grails-app/views/scaffolding/editor/Book.description.gsp (or java.lang.String.gsp, if you wanted to change it for all strings).
Note : to add FCKEditor to your app, you'll have to :
  • Download FCKEditor (
  • Unzip the content then copy the fckeditor folder to sample/web-app/js/
  • Edit sample/grails-app/views/layouts/no-img-skin.gsp and add within the <head></head> tags :
{noformat} <script type="text/javascript" src="${createLinkTo(dir:'js/fckeditor', file:'fckeditor.js')}"></script> {noformat}

There's a lot more to the plugin and tag set. Please look at the docs!

Switching skins

There's a bug in 0.5.5/0.5.6 that doesn't download Dojo properly. You'll need to edit GRAILS_HOME/scripts/InstallDojo.groovy and change the dojoVersion variable to be initialized to 0.4.3. If you're using a recent 0.6-SNAPSHOT or later, then you'll probably have the fix.
  1. Let's take that example above, and say that we wanted to use AJAX in our UI. Let's install Dojo and the Dojo skin. It will ask if you're okay with overwriting each type of element. Say yes to each.
grails install-plugin dojo
grails install-skin dojo
  1. You'll need to regenerate your views and controller for the Dojo skin. It'll prompt you to overwrite each file.
grails generate-all Book
  1. Now re-run your app and go to the list view. The list view supports AJAX paging now. That's it!
  2. Well, ok, we can show one more thing. Date and Calendar objects now will use the date/time widgets of Dojo.
class Book {
    String name
    String description
    Date writtenOn
  1. Re-load your app and go edit a book.
  2. Hmm, we don't want a time widget here. We can override how Dates are rendered in all cases by changing it to render only the date picker. Let's make it use the Calendar renderer everywhere it'd normally use the date/time widget. Create samples/grails-app/views/scaffolding/editor/java.util.Date.gsp.
    def c = new GregorianCalendar();
    if (value != null) {
        c.time = value
<g:renderType template="editor" name="${name}" style="${style}" value="${c}" />
  1. Re-run it again. Done!

Creating your own skin

Most things can be done w/o needing to create your own entire skin. You can override existing scaffolding by adding the corresponding files to your app's view directory and changing the contents. You can also override the templates, just as you can normally under Grails. However, sometimes you'd like to go for a completely different look.

In that case, you may want to take a look at the skins available under the plugin's src/skins directory and potentially copy one into a src/skins directory under your application's base directory.


  • More walk-throughs (relations, skins, widgets, types, beans, styles, except, only, order).
  • Creating a full application.
  • Update to Grails 1.1.1
  • Yahoo UI skin