Spring MVC vs JSF

JavaJsfSpring Mvc

Java Problem Overview


I haved used Struts framework in all my past applications and for the new application,my client has requested to use either Spring MVC or JSF? I am not familiar with these two frameworks but our timelines are strict. So, I am not sure which framework I will choose to build the application.

Can anyone please suggest me which framework will be easy to learn in quick time?

Thanks

Java Solutions


Solution 1 - Java

Of course, it's going to be different for everyone, but I'd suggest Spring MVC, as it's a request-based framework like Struts. Of course, you'll want to learn about core Spring stuff like Inversion of Control / Dependency Injection (but I'd consider that a plus...) and whatever you're going to use for database access (just JDBC? Hibernate? iBatis? etc.).

JSF is component-based, which is a bit different paradigm from request-based frameworks. If you do plan to go the JSF route, I'd suggest looking at Seam from JBoss. It's more of a front-to-back framework that uses JSF as the web/presentation end and EJB as the backend. And pretty much all the people who've used it claim it makes JSF and EJB more usable than they are by themselves.

Good luck on whichever technology you choose, though. (Sounds like you'll need it - strict timelines and a client that's prescribing web frameworks?)

Solution 2 - Java

I'd suggest SpringMVC, because of the timeframe:

  • you need something with less steep learning curve. SpringMVC is more like Struts than JSF
  • in order to use the power of JSF you need to get familiar with many "tricks", while SpringMVC is more or less straightforward

Solution 3 - Java

I'd suggest JSF + Primefaces component library. I am using this combination to build most of our projects. As I remember, I spent one week to learn the technology and finished my first project in one month. The development time at least 30% faster than Struts.

SpringMVC is not a bad technology and it's quite popular.

Really depends on which one your like the most.

Solution 4 - Java

JSF is just the view layer of the MVC and wil need to be used with other technologies like Spring/Hibernate or EJB for a full MVC.

I have been using the Spring MVC for about 1 months now, whilst it's probably not the latyest version of SpringMVC I've found it a little annoying that we have so much XML to deal with. All the managed beans and DAO has XML config to it. Also everything seems to have to go thorugh a method called onSubmit().

JSF with something like EJB is far simplier in my opinion... Everything can be done using Annotations so simply use @ManagedBean=theBean in your backing bean and in your JSF put {thebean.param} and you have access to the backing bean's data. Also you can use the Session beans of your EJB as the backing beans for JSF then have direct acces to the DAO (Model layer) Entity bean. Again simply by using the @Entity annotation and the EntityManager class

Spring MVC is a web framework inside the Spring framework. It does provide features as those in JSF 2.0: ajax-support validation dependency-injection etc Yet, you can use Spring (not Spring MVC) together with JSF 2.0, with spring providing the dependency-injection, aop, transaction management mechanisms, and JSF providing the web layer.

Solution 5 - Java

> Of course, you'll want to learn about core Spring stuff like Inversion of Control / Dependency Injection (but I'd consider that a plus...)

JSF is indeed based on IoC, and much simpler than the Spring learning curve.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionYatishView Question on Stackoverflow
Solution 1 - JavaNateView Answer on Stackoverflow
Solution 2 - JavaBozhoView Answer on Stackoverflow
Solution 3 - JavaTedView Answer on Stackoverflow
Solution 4 - JavaDhrumil ShahView Answer on Stackoverflow
Solution 5 - JavaJ SlickView Answer on Stackoverflow