Render a page in grails without html and body tag
Asked Answered
O

3

5

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.

Orthogonal answered 28/1, 2011 at 15:4 Comment(0)
P
12

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: ...)
    }
}
Palstave answered 28/1, 2011 at 15:21 Comment(0)
I
3

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.

Intussusception answered 28/1, 2011 at 15:11 Comment(0)
S
0

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.

Sadiras answered 28/1, 2011 at 15:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.