Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Render a page in grails without html and body tag

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.

like image 357
Hussain Fakhruddin Avatar asked Jan 28 '11 15:01

Hussain Fakhruddin


2 Answers

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: ...)
    }
}
like image 100
Medrod Avatar answered Oct 24 '22 13:10

Medrod


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.

like image 25
Josh K Avatar answered Oct 24 '22 13:10

Josh K