开发者

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 &l开发者_运维技巧t;html>, <head> or <body> tags.


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: ...)
    }
}


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜