Java view technologies and frameworks are
web-based
A web application (or web app) is application software that is accessed using a web browser. Web applications are delivered on the World Wide Web to users with an active network connection.
History
In earlier computing models like client-serve ...
software libraries
In computer science, a library is a collection of non-volatile resources used by computer programs, often for software development. These may include configuration data, documentation, help data, message templates, pre-written code and subro ...
that provide the
user interface
In the industrial design field of human–computer interaction, a user interface (UI) is the space where interactions between humans and machines occur. The goal of this interaction is to allow effective operation and control of the machine f ...
, or "
view-layer", of
Java
Java (; id, Jawa, ; jv, ꦗꦮ; su, ) is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea to the north. With a population of 151.6 million people, Java is the world's List ...
web application
A web application (or web app) is application software that is accessed using a web browser. Web applications are delivered on the World Wide Web to users with an active network connection.
History
In earlier computing models like client-serve ...
s. Such
application frameworks are used for defining
web pages and handling the
HTTP
The Hypertext Transfer Protocol (HTTP) is an application layer protocol in the Internet protocol suite model for distributed, collaborative, hypermedia information systems. HTTP is the foundation of data communication for the World Wide Web, ...
requests
Request may refer to:
* a question, a request for information
* a petition, a formal document demanding something that is submitted to an authority.
Request may also refer to:
Computing and technology
* in computer science, a message sent be ...
(clicks) generated by those web pages. As a sub-category of
web framework
A web framework (WF) or web application framework (WAF) is a software framework that is designed to support the development of web applications including web services, web resources, and web APIs. Web frameworks provide a standard way to build and ...
s, view-layer frameworks often overlap to varying degrees with web frameworks that provide other functionality for Java web applications.
Java view-layer frameworks often claim to support some or all of the
model–view–controller
Model–view–controller (MVC) is a software architectural pattern commonly used for developing user interfaces that divide the related program logic into three interconnected elements. This is done to separate internal representations of infor ...
design pattern.
At a glance
*
Jakarta Faces (JSF),
Apache Tapestry and
Apache Wicket are competing component-based technologies, abstracting the
stateless HTTP request-response cycle and the
Jakarta Servlet
A Jakarta Servlet (formerly Java Servlet) is a Java software component that extends the capabilities of a server. Although servlets can respond to many types of requests, they most commonly implement web containers for hosting web application ...
API
An application programming interface (API) is a way for two or more computer programs to communicate with each other. It is a type of software Interface (computing), interface, offering a service to other pieces of software. A document or standa ...
behind an
object-oriented
Object-oriented programming (OOP) is a programming paradigm based on the concept of "objects", which can contain data and code. The data is in the form of fields (often known as attributes or ''properties''), and the code is in the form of pro ...
, event-driven component model.
* In contrast, Struts and the
Spring MVC Framework are action-oriented frameworks that provide a thinner
abstraction layer
In computing, an abstraction layer or abstraction level is a way of hiding the working details of a subsystem. Examples of software models that use layers of abstraction include the OSI model for network protocols, OpenGL, and other graphics libra ...
over the servlet
API
An application programming interface (API) is a way for two or more computer programs to communicate with each other. It is a type of software Interface (computing), interface, offering a service to other pieces of software. A document or standa ...
.
* Apache Tiles is a templating framework designed to work with Struts.
*
Facelets
In computing, Facelets is an open-source Web template system under the Apache license and the default view handler technology (aka view declaration language) for Jakarta Server Faces (JSF; formerly JavaServer Faces). The language requires val ...
is a view definition and templating technology designed to work with JSF.
* SiteMesh can be used with any
Jakarta Pages (JSP).
* Facelets, Tapestry and Wicket have their own templating approaches based on
HTML
The HyperText Markup Language or HTML is the standard markup language for documents designed to be displayed in a web browser. It can be assisted by technologies such as Cascading Style Sheets (CSS) and scripting languages such as JavaScri ...
/
XHTML
Extensible HyperText Markup Language (XHTML) is part of the family of XML markup languages. It mirrors or extends versions of the widely used HyperText Markup Language (HTML), the language in which Web pages are formulated.
While HTML, prior ...
.
*
Apache Click uses HTML based
Apache Velocity templates and
plain old Java objects (POJOs), with JSP optional.
Servlet API
The Servlet API is the foundation of almost all Java Web View technologies. Servlet provides the basic mechanism for writing Java
class
Class or The Class may refer to:
Common uses not otherwise categorized
* Class (biology), a taxonomic rank
* Class (knowledge representation), a collection of individuals or objects
* Class (philosophy), an analytical concept used differentl ...
es for web applications. Servlets can respond to HTTP requests, create cookies and maintain sessions.
Jakarta Pages (JSP)
* Built on top of the Servlet API, JSP provides a document-centric, tag-based templates, server programming model which can generate many forms of textual content.
* Java code may be embedded in JSP files and is compiled and executed when a request is received.
Apache Struts
* Struts provides for a
decoupling of the Controller and the View.
* Requests are received by a Java Class (Controller) which can decide which View to display.
* The actual View can be written in different view technologies, like JSP, free marker template, velocity template etc.
* An XML
configuration file is used to specify the "Page Navigation", i.e. the flow of the request to the appropriate Controller, and which View to display based on the outcome of the Controller.
* Competitor: Spring MVC, Grails
Apache Tapestry
* A component-based view framework.
* Classes are written as POJOs and byte-code transformed at runtime
* Configured with annotations and naming conventions rather than XML
* Compared to JSPs, enforces a clear separation of
HTML markup
An HTML element is a type of HTML (HyperText Markup Language) document component, one of several types of HTML nodes (there are also text nodes, comment nodes and others). The first used version of HTML was written by Tim Berners-Lee in 1993 ...
and Java code.
* HTML templates can be directly previewed by web designers
* Changed component classes are live-reloaded into running application for faster development.
* Uses the
Post/Redirect/Get
Post/Redirect/Get (PRG) is a web development design pattern that lets the page shown after a form submission be reloaded, shared, or bookmarked without ill effects, such as submitting the form another time.
When a web form is submitted to a se ...
navigation pattern for form submission.
* Competitor: Wicket, JSF
Apache Tiles
* This is an HTML templating framework based on the
composite pattern.
* It allows for the HTML page to be broken up into multiple "pagelets", called Templates, Definitions and Composing pages.
* At
runtime the pagelets are stitched together to generate the final HTML. Pages are written in JSP.
* Competitor: SiteMesh
Apache Wicket
* A component-based view framework.
* Pages directly interact with stateful Java components on the server.
* Components and their state are managed by the Wicket framework, freeing the application developer from having to use HttpSession directly to manage state.
* Does not require XML for configuration.
* Compared to JSPs, enforces a clear separation of
HTML markup
An HTML element is a type of HTML (HyperText Markup Language) document component, one of several types of HTML nodes (there are also text nodes, comment nodes and others). The first used version of HTML was written by Tim Berners-Lee in 1993 ...
and Java code.
* Web page components are 'pushed' into the HTML markup from the code.
* Competitor: Tapestry, JSF
Jakarta Faces (JSF) and Facelets
* A specification for component-based view frameworks.
*
Eclipse Mojarra and
Apache MyFaces
Apache MyFaces is an Apache Software Foundation project that creates and maintains an open-source JavaServer Faces implementation, along with several libraries of JSF components that can be deployed on the core implementation. The project is div ...
implementations are available
* Typically uses Facelets for XML/XHTML-based templating.
* Classes are written as POJOs, with Annotations or XML configuration files used to associate them with page and component templates.
* The
Unified Expression Language
The Jakarta Expression Language (EL; formerly Expression Language and Unified Expression Language) is a special purpose programming language mostly used in Jakarta EE web applications for embedding and evaluating expressions in web pages.
The s ...
allows binding component fields and events to POJO bean properties and methods.
* Conversion and validation constraints can be specified in Facelets and are automatically applied, normally resulting in reposting of the same page with error information in case of failure.
* Navigation can be via configuration file rules or directly specified in the page.
* Can transparently support
Ajax.
* Competitor: Wicket, Tapestry
SiteMesh
* SiteMesh is an HTML templating framework based on the "Decoration" model.
* It allows for the creation of a 'decoration' template which is then applied to any other HTML to generate a new HTML.
* The newly generated HTML contains elements from the original HTML blended into the template.
* This allows for the original HTML to be very simple and devoid of any formatting or layout specification. The template, in turn, is devoid of any actual information.
* Blending the two allows for a consistent
look and feel
In software design, the look and feel of a graphical user interface comprises aspects of its design, including elements such as colors, shapes, layout, and typefaces (the "look"), as well as the behavior of dynamic elements such as buttons, boxes ...
for all
web pages.
* Competitor: Tiles
Spark
* Spark a micro web framework built around a simple routing system
* It runs on an embedded
Jetty
A jetty is a structure that projects from land out into water. A jetty may serve as a breakwater, as a walkway, or both; or, in pairs, as a means of constricting a channel. The term derives from the French word ', "thrown", signifying somet ...
web server by default, but can be configured to run on other webservers.
* It supports three different templates engines:
Velocity
Velocity is the directional speed of an object in motion as an indication of its rate of change in position as observed from a particular frame of reference and as measured by a particular standard of time (e.g. northbound). Velocity is a ...
,
FreeMarker and
Mustache
* It aims to facilitate rapid development, and does not make use of annotations or proprietary solutions.
See also
{{Portal, Computer programming
*
List of web service frameworks A list of web service frameworks:
See also
* Comparison of web frameworks
* List of web service specifications
* List of web service protocols
* Web service
* Java view technologies and frameworks
* List of application servers
This list com ...
*
List of Java frameworks
Java (programming language)
Java APIs