Im using Spring MVC by itself till now, works great, but i hear from friends that JSF is also good, has some good visual stuff, even though i dont really know much bout JSF. So my question is: Is it possible to mix Spring MVC with JSF? If it is, is it a good thing to do or theres a better way to do it?
-
Why would you do so? Do you want to add complexity in your application? – Romain Linsolas Nov 06 '10 at 16:53
-
Thats what i want to know, is it good, bad? – Onizudo Nov 06 '10 at 17:01
3 Answers
Try to stick with this equations:
- Spring MVC + ORM (hibernate) + JSP + Jquery
or - EJB + JSF + RichFaces

- 1,110
- 7
- 9
-
Thank you for the tip, my app is using spring mvc + hibernate, so might be easier for me to try using jquery xD – Onizudo Nov 06 '10 at 18:34
-
Do you know the applications of jquery with jsp? Ive searched a bit and all i found was specific cases of jquery with jsp, like autocomplete function. – Onizudo Nov 06 '10 at 20:32
-
1To be honest I' used JQuery just as an example (and because I'm using it as rich client side part of the "equation" ;-) but you can use any other JS fw. It all depends on what do you want to do with your client side. You can choose "basic" JSP or you can "upgrade" those pages with for example jqGrid (table like component) and/or some other JQueryUI components. – trix Nov 06 '10 at 20:46
-
Ill have to check jQuery's page to see what parts of it i might use. Thank you for the help xD – Onizudo Nov 06 '10 at 20:54
It is definitely possible but with lot of effort. It's better to use spring framework only for the DI for services and DAO layer and use JSF for front end components. You can define two controllers with two different mappings say one with jsf and one with do and forward requests accordingly.

- 17,402
- 12
- 56
- 86
JSF is primarily component based MVC framework and probably the first successful event based web technology (analogous to Microsoft ASP .Net). One can easily integrate with Spring MVC and it is good approach assuming existing business/web-application has been developed on Spring framework.
It is better to go with JSF2+JDBC(or JPA2) on Tomcat7/JavaEE6 certified servers.
- JSF+EJB3.1+EclipselinkJPA or Hibernate JPA/your choice of JPA implementation
- JSF+JDBC with or without traditional DAO
(1)EJB3.1+JSF2.1/2.2+PrimfeFaces/Tomahawk/Icefaces. Primefaces is one of the best and most popular JSF implementation; because primefaces has got rich UI components and excellent support from forum and nice examples and documentation, inbuilt JQuery support. Few things would be better in Tomahawk adn Icefaces. With JSF2 you can use more than one JSF implementation (i.e. Primefaces & Icefaces). JSF2 is easily pluggable into JDBC, Spring, and other widely used java web technologies.
(2)Just use JDBC+JSF with or without traditional DAOs for small, medium and large commercial web-application projects; because your application would be more easy to develop and maintain, more portable across tomcat and other webcontainers, no need of JavaEE certified (J2EE app servers) servers.