Index: trunk/grails-app/taglib/CustomTagLib.groovy
===================================================================
--- trunk/grails-app/taglib/CustomTagLib.groovy	(revision 666)
+++ trunk/grails-app/taglib/CustomTagLib.groovy	(revision 667)
@@ -195,3 +195,46 @@
     } // sortableColumnWithImg
 
+    /**
+    * Customised version of jasperButton as found in jaser plugin.
+     * custom:jasperButtons is intended to be wrapped by g:jasperForm
+     */
+    def jasperButtons = {attrs ->
+        if(!attrs['format']){throw new Exception(message(code:"jasper.taglib.missingAttribute", args:'format'))}
+        if(!attrs['formName']){throw new Exception(message(code:"jasper.taglib.missingAttribute", args:'formName'))}
+        String formName = attrs['formName']
+        String buttonClass = attrs['class'] ?:  "jasperButton"
+        String format = attrs['format'].toUpperCase()
+        String text = attrs['text']
+        String heightAttr = attrs['height'] ? ' height="' + attrs['height'] + '"' : '' // leading space on purpose
+        String imgSrc = ''
+        String delimiter = attrs['delimiter'] ?: "|"
+        String delimiterBefore = attrs['delimiterBefore'] ?: delimiter
+        String delimiterAfter = attrs['delimiterAfter'] ?: delimiter
+
+        out << '''
+                    <script type="text/javascript">
+                        function submit_jasperForm(name, fmt) {
+                            var jasperForm = document.getElementsByName(name).item(0)
+                            jasperForm._format.value = fmt;
+                            jasperForm.submit();
+                            return false;
+                        }
+                    </script>
+                    '''
+
+        out << delimiterBefore
+
+        attrs['format'].toUpperCase().split(",").eachWithIndex { it, i ->
+            if (i > 0) out << delimiter
+            imgSrc = g.resource(plugin:"jasper", dir:'images/icons', file:"${it.trim()}.gif")
+            def fmt = it.trim()
+            out << """
+                        <a href="#" class="${buttonClass}" title="${it.trim()}" onClick="return submit_jasperForm('${formName}', '${fmt}')">
+                        <img border="0" src="${imgSrc}"${heightAttr} /></a>
+                        """
+        }
+
+        out << delimiterAfter
+    } // jasperButtons
+
 } // end class
