what i want to do, directly at the moment, in the plugin (havnt embedded in project yet ) is to store my jsf/index.xhtml in the normal grails-app/views dir (as you would a GSP) - however this is not in the web root of course
i've mucked around with my controllers/viewresolvers and view in grails mvc side and i have delegated the rendering to JSF like this
so i type into browser [plugin root]/jsf - this goes to the handler and fires the jsfController.index and returns a map
my viewresolver picks this up (i've gone round this alot of times/ways now till i'm blue in the face ) and i'm tweaking view URI and get it all to work .
i also wrote a custom jsfResourceResolver to try and ask JSF to look outside its normal areas like this (i fiddle the basePath stub )
the latest try i tried to use was file:[path] like this - but this also fails to find it. my trace reads "couldnt find check grails-app : file:/grails-app/views/jsf/index.xhtml ", WARNING: JSF1064: Unable to find or serve resource, /grails-app/views/jsf/index.xhtml.
if i hack this so my url looks like "/jsf/index.xhtml" - it happily sorts itself and loads the index.xhtml in my top level web root. -- but thats not the one i want
this is all quite frustrating - if i want to keep the xhtml files in standard grails-app/views directory in plugin (or project incl the plugin) - what does the URL have to look like to locate the resource outside the web-app root directory.
how can i get the resource resolver to go back to [plugin]/grails-app/views and find the jsf/index.xhtml in that area
it would be easy if grails somehow published the grails-app/view directory internally into the web-app root - it must do that i guess but just cant figure out what that URL must be - either that or it somehow use spring resource loading to get from [plugin]/grails-app/views - but i just cant see how this trick is done
I've never worked with grails, so I can't help on grails-specific items. I thought that grails and JSF did basically the same things, though, so I'm unclear on the virtues of mixing the two.
JSF can "mix" with a lot of different architectures, but when I say "mix" I mean as in either JSF handles a URL or the alternative architecture does. For example, you can configure an app so that JSF page requests are routed to the FacesServlet and Struts requests are routed to the Struts ActionServlet. Attempting to make 2 distinct architectures operate on the same URL would require specialized knowledge and APIs that I know nothing about.
Customer surveys are for companies who didn't pay proper attention to begin with.
Joined: Apr 23, 2012
thanks for the reply - but didn't really get me any closer - the reason for mixing the two architectures is that Grails has a really good services/controllers/data layering and provides a front end controller to lookup data into request params - before using jsf2 as render engine.
jsf has some nice rendering libraries (prime faces for example) which Id like to be able to use but interact with the grails controller/services tier
that and its getting me to grub inside some of the internals and learn something new - but its hard work
I've got slightly closer (?) the default jsf2 resource lookup expects resources to be in certain places - but you can register a custom resources resolver - i'm then injecting some grails stuff into that and see if I can do the custom resource location back into grails exploded project structure
not quite sure if this is going to work yet - nearly there I think (famous last words)
so being able to say add a static view ="jsf" say into a controller and have that pick up and use jsf to render the view - rather than GSPs but use GSP elsewhere - feels like a nice mix position which i'm trying to get to
the tricky bit is that grails internals are very geared to GSP and JSP, velocity etc - but not JSF and JSF is standard J2EE render standard so being able to blend and use both including primefaces 'feels' like a good option - it may however yet break me -
slow and tenacious right now. whats interesting in spring grails seems to be I need a resource location prefixed "file: ..." if I try any other format it fails to find a valid resource, the URLS are typically relative to the web-app or the classpath ("classpath: xxx"), and given the .xhtml files in approach are in class path or in web-app (i'm storing them in grails-app/views as you would for GSPs ) this is causing me some grief .
if I can get to work i'll post up how ive 'resolved it'
spring webmvc also integrates with prime/jsf - but grails is hiding a ton of stuff underneath and doesn't use that path and i'm having to interrupt its flow - a little challenging
The fact that someone went to the trouble to write a JSF2 plugin for grails tells me that someone thought it was a good idea. But since JSF already provides very clean Model and Controller services - including input validation - makes me wonder what the benefit is. Just using the JSF rendering subsystem like what people seem to be describing sounds like a lot of overhead for relatively little gain. If all I wanted was a library full of fancy controls, I'd consider using something jQuery-based. I did try using dojo/dojit once, but that didn't work too well.
I can offer very little guidance, since this is outside my daily path, but it sounds like the Grails JSF plugin helps facilitate integration between the namespaces of Grails, JSF, and Spring for EL purposes. The master Controller for JSF is the FacesServlet, so whatever rendering functions referencing Facelets (xhtml) resources are done would have to pass through there unless someone supplanted the JSF master controller with their own logic. And that's pretty risky, speaking from a maintenance standpoint. It would require extensive analysis and updating every time JSF's internals were re-architected. And in my humble opinion, JSF's internals right now aren't nearly clean or simple enough to be expected to have achieved their ultimate form.