Grails snippets
class FileInputTagLib {
 	
    static namespace = 't'
    /*def assetsFileinput = {
    	 out << asset.javascript(src: "bootstrap-fileinput/js/fileinput.min.js")
       out << asset.stylesheet(src: "bootstrap-fileinput/css/fileinput.min.css")
    }*/
    /**
     * @attr name REQUIRED
     * @attr accept
     */
    def fileinput = { attrs, body ->
        def name = TagLibUtils.getRequired("name", "fileinput", attrs)
        def accept = attrs.remove('accept')
        def options = attrs.remove('options')
        
        out << g.render(template: "/taglibTemplates/fileinput", model: [])
    }
 }<g:form action="formSubmit">
    <g:hasErrors bean="${command1}">
        <div class="alert alert-danger">
            <g:renderErrors bean="${command1}" as="list"/>
        </div>
    </g:hasErrors>
    Nombre: <g:textField name="nombre" value="${fieldValue(bean: command1, field: "nombre")}"/><br/>
    Apellido: <g:textField name="apellido" value="${fieldValue(bean: command1, field: "apellido")}"/><br/>
    <g:submitButton name="enviar"/>
</g:form>// --------------------------------------
// Ejemplo básico de un command object
// --------------------------------------
@Secured(['permitAll'])
class TestController {
    def index() {
    }
    def formSubmit(Command1 command1) {
        if (command1.hasErrors()) {
            render view: "index", model: [command1:command1]
            return
        }
        
        render view: "index"
    }
}
@Validateable
class Command1 {
    String nombre
    String apellido
    static constraints = {
    }
}<g:form action="formSubmit">
    <g:textField name="nombre" />
    <g:submitButton name="enviar"/>
</g:form><g:hasErrors bean="${command1}">
    <div class="alert alert-danger">
        <g:renderErrors bean="${command1}" as="list"/>
    </div>
</g:hasErrors>// --------------------------------------
// Ejemplo básico
// --------------------------------------
@Secured(['permitAll'])
class TestController {
    def index() {
    }
    def formSubmit(String nombre) {
        redirect action: "index"
    }
}Esta sección contiene snippets para Grails