tags:

views:

27

answers:

1

I would like to have a snippet html loaded in the action method of a controller. Is there a way to do this?

What I want to accomplish is actually have the Controller action use json as the format to return my response (with error codes and other information) and include a snippet of html loaded from a template file as one part of the json response.

My response would be something like:

{
errCode: 200,
myHtml: "Some html portion loaded from a template file goes here"

... more data elements..
}

The action would return the response with 'render (contentType: "text/json", data);

+1  A: 

You mean like this: http://mrhaki.blogspot.com/2010/05/grails-goodness-use-gsp-template-engine.html

It's hard to see which bit you need help with from your question

tim_yates