I'm planning to integrate JSF2 technology to an existing Spring MVC 3 based web application in order to provide rich user experience to the users. As I don't have previous experience on working with JSF2, I would like to hear your ideas and suggestions. Generally, I want to have a set of views which are served in terms of JSPs (Non-JSF) and the others are in Facelets (JSF). How should I configure Spring and JSF to achieve this? How view resolutionn should be done? For an example, there can be scenarios where a Facelet should be rendered as a result of a Spring MVC controller method invocation.
I have apps that do something like that - mostly to generate XML files - but not rendering Spring MVC Controller into JSF. That would be pretty difficult, since the JSF MVC controller is supposed to control JSF views. You can only have one master view controller per URL request.
As far as using Spring MVC controller for JSPs, that's easy. You don't have to do anything. When you request a JSP, you get a JSP, when you request a JSF, you get a JSF. The URL router matches on your incoming URL to determine which controller is supposed to process the URL, and thereby what view will be selected to render it.
Bjoke: A "Bully Joke". A Statement or action made with malicious intent - unless challenged. At which point it magically transforms into "I was just funnin'" or "What's the matter, can't take a joke?"
Thanks a lot for your valuable response. Yes, you are right, it is pretty hard to mix both Spring MVC and JSF layer together as both have their own way of request handling.
I'm planning to use JSF together with Rich UI component library. And I want to use common JSF functionalities like validation, data conversion, etc. How would be the behaviour if I try to use a JSF page as a view of a request hanlder method in a Spring MVC controller? Will that JSF page behave as it is supposed to be? I mean, will validation, data conversion stuff work according to JSF spec? Will JSF lifecycle work with this approach properly? I'm trying to use following view resolver strategy. (Actually, I just tried this approach, but a NullPointerException is thrown unexpectedly when parsing the JSF page, So i just want to know if it does not work as my approach is wrong)
Will it be beneficial to go with pure JSF model (having mapped URL so that it will be directly served by Faces servlet, other than Spring dispatcher servlet) rather than mixing stuff with both JSF and Spring MVC contrller layer?
What would you think?
Anyone is welcome to share your ideas and suggestions.
After playing around Spring MVC and JSF, I have come to a conclusion to mainly go with JSF-based presentation layer and using Spring MVC as a supporting presentation technology to handle stuff which need not rich UIs and AJAX-based communications. Anyway, the challenging thing is to do the separation on which should be handled by JSF and which should be handled by Spring MVC.
SCJP, SCWCD, SCMAD, SCSNI
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop