views:

1539

answers:

6
+6  Q: 

Spring vs. JSF

I have a dilemma at my job. We're looking to integrate two different J2EE projects and they both use different frameworks for the web component. We're also looking to add more dynamic capability/AJAX to it. One uses JSF and the other uses Spring. Basically we're trying to pick one of the projects and integrate them using that technology. So I have two questions:

1) Is JSF and Spring mutually exclusive? Is it one or the other? 2) If so, which one is better?

+1  A: 

Spring tends to embrace pretty much any library/framework that rolls along, so JSF and Spring shouldn't be mutually exclusive; it probably depends at least somewhat on the framework using JSF. As for JSF, I still haven't heard much in the way of positive feedback from any of my colleagues who use it.

Hank Gay
A: 

Refactoring your UI to use a different toolkit just in the name of corporate consistency isn't very kind to the users. There should be a tangible benefit to justify it. Sure, supporting one toolkit over another can lead to reduced maintenance costs, but the refactoring cost would be large for any reasonable app. You'd basically be throwing out one entire UI and building it from scratch.

I'm sure they can both run alongside each other without too much hassle (though using them for the same pages/user interactions would probably be awkward). As to which is better, that depends on the staff you have and what their level of comfort it.

davetron5000
+1  A: 

I've used JSF and some Spring, but not at the same time, and they shouldn't be mutually exclusive, unless the Spring based app used a non-JSF Spring UI system. Most Spring systems seem to use straight JSP or Tapastry or whatever. My suspicion is that, though the technologies aren't mutually exclusive, your particular usages of them will be. In which case you'll find yourself caning one UI in favor of the other. I'd judge based on the quality and extensibility of the two.

sblundy
A: 

It depends on what you mean by Spring. My first taste of Spring and JSF was on a project that used both. Spring for data access and JSF for presentation.

Ed.T
+1  A: 

Usually, Spring is integrated into JSF only as a bean and variable resolver.

http://jsf-spring.sourceforge.net/

Heath Borders
+1  A: 

Version 2 of the Spring Web Flow project contains a spring-faces piece that adds some of the capabilities of Spring and Spring Web Flow to JSF. You can use Spring beans in place of your managed beans and manage the scope handling of those beans.

If you don't want to use the whole web flow functionality, Spring also has built in resolver objects that you can use to inject Spring beans into JSF managed beans via the faces-config.xml file.

There's also a MyFaces subproject called Orchestra that is Spring-based, but I haven't looked into it yet.

Jason Gritman