Tech News

Introducing Java Web Development

JVM Languages

The JVM is the runtime environment that provides you with the ability to use different programming languages for building web applications. The JVM languages can be largely classified into two types: languages that are designed for the JVM and existing languages that are ported to JVM.

Languages Designed for the JVM

Where Java 8, Groovy, Scala, and Clojure fall on the functional language continuum. Java 8 introduces lambdas, which makes it slightly functional, Groovy has had functional constructs since its inception and is even more functional with Groovy 2.0, and Scala is the most functional of the three object-oriented (OO) languages. Clojure, on the other hand, is a purely functional, non-OO language.

Java EE

Java began life as a programming language designed for building stand-alone applications and grew rapidly into other spheres. A large part of Java’s popularity can be attributed to its usage in creating web applications. A web application consists of static and dynamic (interactive) web pages. Static web pages contain various types of markup languages (HTML, XHTML, and so on) and are used, in general, to provide information; dynamic web pages, on the other hand, are capable of generating content with the aid of additional web components. Thus, a web application is a collection of web pages and is capable of generating dynamic content in response to requests. Unlike a web page used merely to provide information, a web application lets you perform some activity and save the result. Developing a web application, however, is fundamentally different from building stand-alone applications and requires you to understand the following three key elements.

The Java EE Platform

The Java EE platform is aimed at standardizing and reducing the complexity of enterprise application development by providing an application model that defines an architecture for implementing services as multitier applications. In a multitier application, the functionality of the application is separated into distinct functional areas, called tiers.

The Client Tier

The client tier is the top tier in a multitier Java EE architecture; it consists of application clients that make requests to the Java EE server, which is often located on a different machine. The server processes the requests and returns a response to the client. An example of a client is a web browser or a stand-alone application.

The Web Tier

The web tier consists of components that handle the interaction between clients and the business tier. After receiving a request from the client, the web tier does the following:

  1. Collects input from the client
  2. Controls the flow of screens or pages on the client
  3. Maintains the state of data for a user’s session
  4. Obtains results from the components in the business tier
  5. Generates dynamic content in various formats to the cline.

Service Layer

The service layer consists of the business tier components of Java EE such as Enterprise JavaBeans (EJBs). The service layer can access the data access layer, but there should be no tight coupling between the service layer and the data access layer. In fact, the service layer should not know anything about the web or data access layer. The service layer provides a coarse-grained interface for the web layer.

Data Access Layer

The data access layer consists of the data tier components of Java EE such as JDBC and JPA. This layer should not contain any business logic. This layer abstracts the actual persistence mechanism (in other words, JDBC or JPA) from the service layer by providing the coarse-grained interface to the service layer.

Oracle and the Java Community Process (JCP) provide standardized enterprise components, and if successful enterprise applications can be built using these components, then why do we need web frameworks? What are web frameworks for? The next section answers these questions.

Last word

Instead of simply declaring one web framework as the best, this book intends to show the strengths of the most popular web frameworks by means of a real-world bookstore application. Developing a complete real application necessitates a seamless collaboration of dynamic functionalities, and the code for building such components is contrived and too involved. Instead of focusing on developing such moving parts, this book confines its attention on leveraging the strengths of each web framework. Throughout the book, you will learn how to use Java EE and the Java web frameworks to build the bookstore web application

Related Articles

Leave a Reply

Your email address will not be published.

Back to top button