First things that comes in mind
- Respond was introduced in Grails v2.3.
- Render is used by Grails to render different forms of responses from simple text response, to views to templates.
- Respond automatically attempts to return the most appropriate type for the requested content type.
- Respond is a better version of render, and can do everything render does.
ExampleIn case you want to send data to the view in "xml" or in "json" format then you will have to do the following
- render : // renders text for a specified content-type/encoding
some xml", contentType: "text/xml", encoding: "UTF-8"
some json", contentType: "text/json", encoding: "UTF-8"
- respond : by using respond, it will automatically select the correct return type respond( text: "some text in json or xml" [formats : ['xml' , 'json']]) it will automatically send the required respond depending upon the type of request.