PWFraley
PWFraley

Reputation: 1082

Grails GSP Organization

I am looking for a best practise on how to organise grails GSP, and also on how to manage GSP extensions. I am working on an application where I need to create my own GSP HTML elements as well as override standard GSP elements and I would like to know how to organise them.

My consideration is to write a Grails Plugin which has its own Taglib with my own namespace. And creating all the elements that I need and also override the existing ones.

Are there any good examples out there on how to organise things like that?

Upvotes: 0

Views: 108

Answers (1)

user800014
user800014

Reputation:

I agree that taglibs is the best place for GSP customizations. Even the Grails Website have their own tags. Some points that I can remember now:

  • There's this great post that give you some tips about taglibs. The post shows you how to test, overwrite and reuse tags.
  • For namespaces, I recommend you check first which plugins the app will use, to avoid conflicts.
  • For integration tests you can extend GroovyPagesTestCase
  • Generating html inside a taglib can become a little hard to maintain, but you can create templates and use g.render (if is inside a plugin, always define this attribute in the call) or use GSP Taglibs plugin

Upvotes: 0

Related Questions