As Java has evolved over the years, multiple attempts have been made to simplify development for various use cases. From official standards like Java Enterprise Edition, to community-driven frameworks, Java is continuing to prove itself to be adaptable and viable.
Our top list is based on usage from Hotframework.com's Java ranking and several other sources including blog posts and GitHub download numbers.
The most popular Java web frameworks are:
Java Frameworks that are popular but not for the Web (We don’t want to forget them):
- Hibernate (Data-focused)
- Maven (Build-focused)
- Apache Ant with Ivy (Build-focused)
 
Spring
Project Site: https://spring.io/
Primary Sponsor: Pivotal Software
Spring is more than just a web framework. It is a complete programming model that is built on and with Java, starting with Spring Boot, which is a way to get a spring application up and running with minimal configuration and no application server required. At the other end of the spectrum is Spring Cloud, which is a combination of components that allows developers to build resilient and reliable cloud-native applications that leverage the latest distributed patterns like a microservices architecture — two examples include application security and batch processing.
There are many use cases for Spring, and with the introduction of Spring Boot, it is a great solution for companies that are moving towards containers as it greatly simplifies the components required to support the running application.
Getting started with Spring is as simple as going to Spring Initializr and selecting the build framework you desire and any and all the Spring projects you want included in the initial application. It will create the Maven or Gradle configuration and all the basic spring configuration required to start.
Creating a simple web application starting with Initializr (Figure 1):
… which will create a Zip file with the following files in it:
./mvnw.cmd
./pom.xml
./.gitignore
./.mvn/wrapper/maven-wrapper.properties
./.mvn/wrapper/maven-wrapper.jar
./mvnw
./src/test/java/com/example/demo/DemoApplicationTests.java
./src/main/resources/application.properties
./src/main/java/com/example/demo/DemoApplication.java
You need a Controller — src/main/java/com/example/demo/DemoController.java
:
package com.example.demo;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class DemoController {
@RequestMapping("/hello")
public String hello() {
return "hello";
}
}
And a template file — src/main/resources/templates/hello.html
<!DOCTYPE HTML>
<html>
<head>
<title>Hello World</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<p>Hello World</p>
</body>
</html>
 
JSF (Java Server Faces)
Project Site: http://www.oracle.com/technetwork/java/javaee/javaserverfaces-139869.html
Primary Sponsor: Oracle (soon to be a separate foundation)
JSF is a specification for displaying web user interfaces that is defined as part of the Java Platform, Enterprise Edition (JEE). JSF 1 was released in 2004, incorporated into JEE 5 and uses Java Server Pages (.jsp) as its templates. JSF 2 was released in 2009 as part of JEE 6, and leverages Facelets for templating and supports AJAX calls with a browser to allow modern web application lifecycles. JSF is component-based, allowing it to be expanded with additional components. IceFaces and MyFaces are examples of popular add-on components.
As JSF is part of the Java standard, it is popular with development teams that want to stick to published standards for increased portability across platforms. JSF also allows existing backend Java code to be extended with a web interface without having to refactor the base application by introducing a new framework.
A simple JSF application requires a Managed Bean, Facelet, and mapping the servlet.
helloworld.java
package helloworld;
import javax.faces.bean.ManagedBean;
@ManagedBean
public class HelloWorld {
final String world = "Hello World!";
public String getworld() {
return world;
}
}
helloworld.xhtml
<html lang="en"
xmlns_h="http://java.sun.com/jsf/html">
<h:head>
<title>Facelets Hello World</title>
</h:head>
<h:body>
#{hello.world}
</h:body>
</html>
web.xml
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
 
GWT (Google Web Toolkit)
Project Site: http://www.gwtproject.org/
Primary Sponsor: Google
GWT is much like JSF in that it is strictly focused on building web interfaces. It is more popular than native JSF as it makes it easy to maintain complex JavaScript user interfaces with Java code. GWT has lost some of its popularity over the last couple of years as more development teams are pushing Java to the backend and having it expose REST APIs which are consumed by both native mobile apps and user interfaces built in Node.js, using frameworks like Angular.
A tutorial on how to build a simple GWT application can be found on its project site: Getting Started building a GWT app.
 
Play
Project Site: https://www.playframework.com/
Primary Sponsor: Lightbend
Play is an open-source, powerful and lightweight Java framework that makes it easier to build web applications. It follows the MVC design pattern and contains inbuilt features such as code reloading and convention over configuration.
Play provides minimal resource consumption, and is high performance due to asynchronous processing. It enables building scalable, modern web and mobile applications. It also boasts high reliability, flexibility and security features.
 
Struts
Project Site: https://struts.apache.org/
Struts is an open-source Java EE framework used for creating enterprise-level Java web applications. Development is much easier with Struts since it uses the MVC pattern and convention over configuration. The MVC pattern also enables clean designs that are easy to implement. Struts is easy to set up and provides much more flexibility and extensibility over traditional MVC using servlets and JSP.
Struts has a plugin-based architecture and it comes with plugins for REST, AJAX, Config Browser and JSON. It can be easily integrated with other Java frameworks like Spring and Hibernate. Due to its rich functionalities, it is one of the most preferred frameworks for developing enterprise-level applications.
 
Vaadin
Project Site: https://vaadin.com/
Vaadin is an open-source Java web framework with an active community. It allows developers to build complex, dynamic and interactive applications using pre-designed UI components. Developers can create rich layouts and UIs without having to write HTML, CSS and JavaScript.
Vaadin provides a server-side architecture that contains several useful features such as Data Binding APIs, automated routing and client-server communication. These features allow developers to focus on the presentation layer only.
 
Grails
Project Site: https://grails.org/
Grails is a dynamic Java web framework that is based on the MVC design pattern. It is written in Groovy but is perfectly compatible with Java syntax and runs on the Java platform. It is a full-stack framework with built-in support for REST APIs.
Grails comes with several useful features such as an extensive library of plugins, dynamic formation and object mapping. It is also very developer-friendly and comes with detailed, high quality documentation and step-by-step guides. Grails follows several modern software development principles such as convention over configuration, opinionated APIs and sensible defaults.
 
Hibernate
Project Site: https://hibernate.org/
Primary Sponsor: Red Hat, Inc.
Hibernate is a stable and lightweight ORM tool that can easily communicate with any database and therefore makes handling them with Java much easier. It is easy to scale up, configure and customize.
Hibernate provides powerful APIs and several useful tools that provide a smooth experience for developers. While it is not a fully independent framework, its support of object-level relationships and an abstraction layer for interacting with databases make it a popular choice for Java developers.
 
Conclusion
In summary, there are many viable Java Web Frameworks that can be used to address your needs. None of the top three are bad choices—It comes down to personal preference. Just be aware that once you commit to a framework and start to leverage its features, switching to another framework is not an insignificant amount of work.
If you haven’t already, signup for a 14-day free trial of Rollbar and let us help you take control of impactful Java errors. 🙂