I spent the first day of the new year learning about Grails Plugins and how to integrate JSF2, Webflow and Primefaces together in a grails application. My goal was to create a plugin that I could use to add what I think would be a great set of features for UI development altogether into a Grails app. No luck so far but I did learn some things.
First, Spring's bigotry against JSF shines thru with Grails. Aside from ICEFaces donating a plugin to try and get you to use IceFaces in Grails, there is not much information about JSF integration out there.
Second, WebFlow seems to be a second class citizen in Grails these days too. It used to be a default plugin, now they say you just add it yourself, and the source code says it's on github, but there's no evidence of it there as near as I can tell.
Those two issues put a halt on my progress but there are a few things I learned that may be of interest to you. First, plugins write to the web.xml via the XXXGrailsPlugin.groovy. For example,
def doWithWebDescriptor = { webXml ->
def contextParam = webXml."context-param"
contextParam[contextParam.size()-1]+{
'context-param' {
'param-name'('javax.faces.DEFAULT_SUFFIX')
'param-value'('.xhtml')
}
}
can be used to add the JSF default suffix context parm. There are similar methods for writing filters, servlets, listeners etc. Check out XMLSlurper (http://groovy.codehaus.org/api/groovy/util/XmlSlurper.html).
The svn repository of existing plugins is at https://svn.codehaus.org/grails-plugins and is a good resource to see how others have gone about things.
The spirng examples svn now includes a Primefaces/WebFlow example project (https://src.springframework.org/svn/spring-samples/webflow-primefaces-showcase). It's a good starting point, particularly for non-Grails.
This new year I hope to increase my internal fortitude and take a run at JSF/Grails/Primefaces plugin again!
Good stuff Scott! I myself scaled down on my Grails rave. It seems perfect if you want to whip up a quick CRUD app, but then if you want to do something more robust things could get hairy in a heartbeat. My rave was first shaken, when I took a new release 1.3.6 and the Ajax tags stopped working. For my second disappointment I just needed a list of hasMany objects to come sorted(should be easy right?) but it just did not work the way the documentation said it would.For a third, I just needed to pass model attributes to a method on Domain class from the gsp - that ended up being a traumatic ordeal - I just gave up and worked around it. Maybe Grails is still a bit immature...
ReplyDelete