Render a page in grails without html and body tag

3.1k views Asked by At

I want to render a page in grails without a <html>, <head> and <body> tag, I just want DIV and tables.

I want to integrate this page in my Facebook page and the requirement of Facebook page is that the page should not contain <html>, <head> or <body> tags.

3

There are 3 answers

0
Medrod On BEST ANSWER

You can use a gsp-template (GSP file name start with '_'). Than you can call you controller an use the render method.

class MyDomainController{
    def myAction = {
       ...
       render(template:'myTemplate', model: ...)
    }
}
0
Josh K On

Define a layout that only contains the <g:layoutBody /> tag.

I recommend reviewing Grails Web Layer. Note that if you aren't using layouts then you can simply omit the head and body tags. SiteMesh (and Grails) doesn't care if they are there or not. Another poster recommended a template. If you are using layouts with SiteMesh then it might be easier to simply render a template then write a overriding layout.

0
sbglasius On

Grails do not care, if there is a html and head tag in your gsp, and if you choose to make a gsp without a template, that's fine too. If you only make a page fragment, grails will render this happily.