Justin Galzic
Justin Galzic

Reputation: 3971

Load snippet of html in controller

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);

Upvotes: 0

Views: 354

Answers (1)

tim_yates
tim_yates

Reputation: 171114

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

Upvotes: 1

Related Questions