Reputation: 24761
This question relates to my previous question, but is actually wider. So, it turns out that GSP in Grails and GSP, using groovy.servlet.TemplateServlet are quiet different things.
Grails provide set of additional tags and mechanisms which are absent in "pure" GSP. The question is - how can I separate GSP functionality from Grails as much as possible. By "as much as possible" I mean that there are actually some features in Grails GSP which makes sense only in grails (like binding to controllers). Nevertheless, all that nice things like gsp:inlcude, custom tags and so on and so on - is there a cheap and elegant way to use them separately?
Upvotes: 2
Views: 201
Reputation: 7048
Like often with Grails, you have to go deeper in the stack. Here you fall on Spring MVC framework.
Spring MVC allows you to use most templating frameworks, but you'll have to deal with its documentation. Spring MVC needs a ModelAndView object, and Grails can return it :
def index = { // get some books
def favoriteBooks = ...
return new ModelAndView("/book/list", [ bookList : favoriteBooks ])
}
For the moment,using GSP as first class objects is an open issue, and there is a nice blog post that describe the problem.
My conclusion is that there is still some workaround, and if you try something on your own, it may be overturned in a future Grails release.
Upvotes: 1