Java has been around for a while. Soon after its initial inception, Sun started to push the platform towards the web. Now many years later, there are dozens of web frameworks and every now and then the same question pops up: which Java web framework is best.
No framework is perfect, they all have their merits and they all have their breaking points. There is not a single web framework out there that will work for all requirements out there, still there could be found arguments why one framework is better than others and for what types of applications. So let’s have a look at most viable Java web frameworks:
Servlets and JSPs
Some developers say that JSP technology is seriously outdated, while others see it from a little other point of view. The fact of the matter is that Servlets and JSPs do nothing for you – you do everything including mapping request parameters to objects and validating them.
Even with a big variety of frameworks out there, there is still a place for Servlets & JSPs. Smaller web applications are still quickly and cleanly built using them and you don’t need any external dependencies either. The only side note is that you do it properly, which means using Servlets to invoke business logic, using JSPs to generate the view and having JSPs contain no Java code, only JSTL tags and if you want custom tags.
Pros: good for a few pages/functions to implement
Some hate it, some love it. The main reason most people hate it is its steep learning curve and the fact that people use it for all the wrong purposes. Speaking of the right purpose, JSF is primarily aimed at being used to build web components for enterprise applications. It is excellent for creating complex user interfaces as the framework takes care of wiring UI components to backend classes with automated validation and transformations going on. Due to its stateful nature you even have an object representation of the web UI available to you server side.
JSF itself is only the base actually. It is designed to be extended, and many third parties do just that. On top of JSF you also have JBoss, Richfaces, Icefaces, Primefaces, Oracle ADF, Apache Tomahawk, JBoss Seam, Omnifaces, etc. They all share the fact that they extend core JSF with more functionality, which usually comes in the form of Ajax controlled “rich internet components”. Jboss Seam is unique in that list as it does not actually aim to extend, but “seamlessly wire together” many frameworks and technologies to the enterprise platform.
Pros: Good for medium to complex enteprise webapps where full control over the front end is not a requirement. If the application is built and designed around a solid backend, JSF 2.1 is your friend.
Cons: Not an easy material. JSF is hard, and there isn’t rich online documentation. If your application aims around a rich and dynamic web 2.0 front end, JSF is not your friend.
Spring framework is not quite a ‘web framework’, but it is unique. IT shares JBoss Seam’s aim in wiring together many different technologies, both frontend and backend. You can use it as an alternative to Java Enterprise Edition technology, but you are just as free to wire Spring and JEE technologies into the same application.
So what does Spring offer itself? A bunch! It has a bean autowiring system to replace (or extend) the dependency injection model as it exists in the JEE specification. It also has an incredibly strong security model. Additionally instead of manually constructing objects, you “inject” them from a Spring managed context. Next Spring has a strong emphasis on the Model View Controller pattern. Spring provides default controller types for example, but you can also implement your own. As for the model layer the framework can setup JDBC, Hibernate, JPA, etc. for you and it can even manage the sessions and transactions. And finally it offers a built in web front end framework with easy to use annotations. I guess there is much more to add to this.
Pros: Excellent for building and maintaining large enterprise applications that also target other legacy systems and technologies. Spring is so flexible you’ll have the least trouble adapting it to whatever you already have floating around. Also there is a huge community around Spring.
Cons: Clunky due to its hugeness. There is also a big amount of legacy that the framework has to drag around.
Struts 2 is actually quite a clean and neat framework. If all you want to do is create simple web applications, “web 2.0” or otherwise, then it isn’t a bad idea at all to consider Struts 2. But it has limitations. The security model is weak. In this world of web heightened security demands, the framework does nothing to assist you or to help you prevent doing it wrong.
Pros: Good for web applications that do not have high security demands but will be a mix of complex forms and dynamic frontend pages. Low learning curve.
Cons: Weak security
Wicket is also friendly to the developer. It integrates nicely into IDEs and even has built in support for hot-deployment making it far easier to change and debug your applications. Also boring and cumbersome features like making your application multilingual is made incredibly easy.
Pros: Wicket can handle most webapp needs including those that are oriented on the back-end and those that are oriented on the front-end.
Cons: Weak documentation (including the books); the alternative API design.
GWT offers incredibly powerful browser user interface capabilities; using it you can create the coolest web front ends with relatively little work. Google creates most of its own online web services using GWT.
On top of GWT itself Google also provides you a wide range of tools, for example a rich set of plugins for Eclipse. This makes it a complete package that is completely carried by Google itself. This keeps it all tightly integrated and documented, which is a big plus for a web framework.
Pros: Good to create highly complex and feature rich web user interfaces
Cons: The framework is different from any other framework out there. When you want to use it you start from scratch, so it may make it hard to adopt it for a new project.
This framework is relatively young. It lays down the rules, brings the conventions and provides you the foundation to allow you to quickly and painlessly develop web applications, without boilerplate, dependency conflicts or layer upon layer of configuration.
This framework can utilize the benefits of the Scala language (but it is also built for the Java language). The same is true for Play 2.0 which is out right now, and more so. This is mostly because the framework is modeled almost entirely after Ruby on Rails 3 including the available tooling.
Pros: stripping away the boring part of Java web development; being completely stateless and Rest-enabled; providing perfect hot-deployment without need for JRebel or JPA entities; integrates with many popular and important web technologies; manages dependencies for you without needing to learn the complexities of Maven; consolidates web dev into a neat package; incredibly easy ORM model based on Hibernate and JPA 2.0, with an additional layer that takes away the cumbersomeness.
Cons: The programming model is quite counter-intuitive; navigation is based on throwing exceptions. deploying is a bit of a mess using Play as you don’t deploy classes, you deploy the source files. The (alternative) way you manage a Play project makes it difficult to integrate it in for example a JEE application in a way that is easy to maintain.
For sure there are many, many more frameworks to be discussed, but most of them serve the same purpose. Could you pass out your personal recommendation what frameworks is better to use and for what types of application?
Thanks a lot in advance for sharing your advice!
Have a look at HybridJava as well! That is what surpasses JSP and Struts.
Should consider Grails in the analisys. It is a great Web framework.
got it 🙂 Please have a look at http://altabel.wordpress.com/2012/11/20/what-are-the-grails-advantages-over-other-java-web-frameworks/
Grails is a joke. It’s memory footprint is unbearable (seems like they put everything they could find in java and groovy in it), an average sized grails application consumes 300-500 Mbytes of memory. Windows XP requires half of that, which is an operating system with a lot of stuff, not some fancy schmancy web framework.
Props for documentation though.
I used a lot of JSF and now using Wicket. It is indeed that JSF is easy to create business apps. Wicket is really neat to create good looking web apps / websites. The documentation is “poor” but there is a lot to read in the JavaDoc! Wicket has also strong security history!
I prefer Wicket, also a nice one to mention is Vaadin. it’s gaining popularity and it is based on GWT, with Vaadin you create an GWT app with backend.
For a global framework approach, you should also have a look at Telosys ( http://www.telosys.org/ ) with its code generator (Eclipse plugin)
cool informative article.. thanks for sharing.. 🙂
For beginners to this world, which one is good to directly jump-in before evovling to others .
amazing article!!! Thanks a lot for sharing infromation
For me, Wicket is the best java web framework.
Wicket is far ahead in term of OO programming model, has an easy learning curve, is component oriented, everyting can be tested, has great community, has already 8 books http://wicket.apache.org/learn/books
and has a great community http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html.
Spring as a whole is not a Web Framework but Spring MVC and Spring WebFlow both are. It is a shame you didn’t assess them rather than bringing Core Spring into the article..
Spring MVC is nothing more than a can of old garbage. It contains stone age items like Velocity, FreeMarker and Struts 2. Nothing of its own.
Consider Apache Wicket as a powerful java web framework.
It’s efficient, very well written, and last but not the least it’s fun !
I see that struts 2 is labeled with “weak security”. What is the weak security parts about it ? I know it had problems with OGNL and you could have it executing arbitrary code, but those problems are now fixed. So i just am curious about how you have landed on the “weak security” conclusion ?
Very good post. I used to program .Net (2002-2006), then J2EE with Struts,Eclipse,Ant (2006-2008) and finally back with .NET since 2008. I have to admit that Java framework are over-complicated compared with .NET. I don’t think I’ll ever go back with Java and it’s sad because it is the language with which I really learned OOP. The good thing is that C# is so close to Java that I feel like home now.
I have used various java web techs for the last 7 years. I can say only one thing.. there is no holy grail and no one will be!! That said each framework has pros and cons. It depends on what you want to build. Have you seen a painter using just a single type of brush?
The more experience you get the more you understand. The more you understand the more complex problems you can solve and so on..
For example, in our company we are using the ZK framework to build desktop-like business web apps. It would be at least silly to use the same framework to build dynamic web pages for our business web site.
I believe that Microsoft is not the EVIL. Microsoft has contributed many things in the software industry. For example, the ZK framework that we are using has adopted the MVVM (model-view view-model) pattern which i think is MS’s invention. But i would advise you not to forget java completely.. you will find her in your way somehow..
In my point of view vaadin is better frame work because there are sevrel inbulit UI components are designed internally and reduces the work of UI designers and every layer is a .java file.
Whats up! I just would like to give a huge thumbs up for the nice data you’ve got right here on this post.
I shall be coming again to your weblog for more soon.
always happy to see you here!
Excellent article Aliona, thanks for sharing this valuable information in a very clear way.
After I initially commented I appear to have clicked the -Notify me when new comments are added- checkbox and
now every time a comment is added I get 4 emails with the same comment.
There has to be a way you can remove me from
that service? Cheers!
Great article, Play looks a great FW, but so does Spring, I will look further into GWT, food for thought 🙂 Many thanks
Useful article, thanks!
This post is really a pleasant one it helps new the web viewers, who are wishing in favor
Hi! I could have sworn I’ve visited this web site before but after
looking at a few of the articles I realized it’s new to me.
Anyhow, I’m certainly happy I found it and I’ll be book-marking it
and checking back often!
I every time used to study paragraph in news papers but
now as I am a user of web therefore from now I am using net for
articles, thanks to web.
thanks Aliona. JSF is a standard and i found it very easy to learn. it is a good framework for beginner and people who want to have a quick result.But honestly Spring is more mature for developer who want security and customised applications. if you like scripting and you have a good understanding of java don’t hesitate for Spring.
If JSF is easy to learn – what would you tell about HybridJava?
I don’t even know how I ended up here, but I thought this post was good.
I don’t know who you are but definitely you’re going to a famous blogger if you are not already 😉 Cheers!
We have been using Vaadin for a few years now. It’s very flexible, looks new and slick. And they continue to release new themes and tools. Plus you get all the add-ons people have developed.
But the biggest advantage is that our code and logic are protected with the server side design.
Your style is really unique in comparison to other people
I’ve read stuff from. I appreciate you for posting when you’ve got
the opportunity, Guess I’ll just book mark this blog.
Having read this I believed it was extremely enlightening.
I appreciate you spending some time and energy to put this informative article together.
I once again find myself spending a lot of time both reading and posting comments.
But so what, it was still worthwhile!
spring is the best for sure
I have previous experience with Spring MVC and currently I’m working with JSF(Richfaces). In my opinion they are for totally different purposes once each one came from a
Why nobody talks about adf as agreat framework ,is not it ?
Oracle used it to build oracle fusion applications .
Nice article! Great efforts towards this article. well, you can add some of other frameworks like Vaadin, Grails, Apache Tapestry, JBoss Seam and so on. Each framework contains different kind of functionalities like Jboss is useful for developing Enterprise Application and Vaadin Framework to build single-page web UIs for your Java applications. If you like to know more about Java Platforms you can check out this article for sure.
Great article! with good list of java web frameworks.You have covered almost all frameworks here and what i heard about Spring MVC it is also one of the latest java web frameworks 2017.Thanks for sharing with us.
“Best” is a big word! It all depends on your needs… In my opinion, the best framework is the one that you are the most confortable with.