Jump to content

Java view technologies and frameworks

From Alfawiki
Adapted from the English Wikipedia article Java view technologies and frameworks, available under CC BY-SA 4.0Updated 9 August 2025

Java view frameworks and technologies are web-based software libraries that deliver the user interface or "view layer" for Java web applications. These application frameworks define the structure of web pages and manage the HTTP requests originating from those pages. As a subset within web frameworks, view-layer frameworks frequently intersect with other Java web application frameworks.

A significant number of Java view-layer frameworks implement the model–view–controller architectural pattern.

Overview

Action-oriented frameworks: Apache Struts, Spring MVC
Component-oriented frameworks: Apache Click, Apache Tapestry, Apache Wicket, Jakarta Faces
Web templating systems: Apache Tiles, SiteMesh, Thymeleaf
  • Frameworks like Jakarta Faces (JSF), Apache Tapestry, and Apache Wicket are component-driven solutions that encapsulate the stateless HTTP request-response cycle and the underlying Jakarta Servlet API within an object-oriented, event-centric component architecture.
  • Conversely, Struts and the Spring MVC Framework adopt an action-based approach, providing a more minimal abstraction layer over the servlet API.
  • Apache Tiles serves as a templating system primarily designed to complement Struts.
  • Facelets functions as a view definition and templating tool specifically developed for JSF.
  • SiteMesh is compatible with any JSP implementation.
  • Facelets, Tapestry, and Wicket utilize proprietary HTML/XHTML-based templating methods.
  • Apache Click integrates HTML-based Apache Velocity templates alongside plain old Java objects (POJOs), making JSP usage optional.

Servlet API

The Servlet API forms the foundation for nearly all Java Web View technologies by providing essential capabilities for developing Java classes in web applications. It manages HTTP requests, handles cookies, and maintains user sessions.

Jakarta Pages (JSP)

  • Built upon the Servlet API, JSP offers a tag-centric, document-oriented server programming model to produce various types of textual output.
  • Java code can be embedded directly within JSP files, which are then compiled and executed in response to requests.

Apache Struts

  • Struts separates the Controller logic from the View layer.
  • Incoming requests are processed by a Controller Java class that selects the appropriate View to render.
  • Views may be created using technologies such as JSP, FreeMarker, or Velocity templates.
  • Navigation between pages is governed by an XML configuration file that maps requests to Controllers and assigns Views based on Controller results.
  • Rivals: Spring MVC, Grails

Apache Tapestry

  • A component-driven view framework.
  • Uses POJO classes that undergo byte-code transformation at runtime.
  • Configuration relies on annotations and naming conventions instead of XML files.
  • Promotes strict separation between HTML markup and Java code, unlike JSPs.
  • Allows designers to preview HTML templates directly.
  • Supports live-reloading of modified component classes to accelerate development cycles.
  • Implements the Post/Redirect/Get pattern for form submissions.
  • Competitors: Wicket, JSF

Apache Tiles

  • A templating framework for HTML that utilizes the composite pattern.
  • Divides web pages into smaller components called "pagelets" (Templates, Definitions, Composing pages).
  • These pagelets are merged during runtime to produce the final HTML output; pages are implemented with JSP.
  • Competitor: SiteMesh

Apache Wicket

  • A view framework based on components, featuring stateful Java objects managed on the server side.
  • Handles component state internally, minimizing the necessity for direct HttpSession manipulation.
  • Operates without requiring XML configuration files.
  • Promotes a clear distinction between HTML markup and Java logic, in contrast to JSPs.
  • Components are programmatically inserted into the HTML markup.
  • Competitor: Tapestry, JSF

Jakarta Faces and Facelets

  • Defines a specification for component-driven view frameworks with implementations such as Eclipse Mojarra and Apache MyFaces.
  • Employs Facelets as its XML/XHTML templating system.
  • Uses POJOs connected to templates through annotations or XML setup.
  • Utilizes Unified Expression Language to link UI components with POJO properties and methods.
  • Incorporates conversion and validation features within Facelets, usually redisplaying pages with errors if validation fails.
  • Navigation is configured either declaratively or embedded within pages.
  • Provides seamless integration of Ajax functionality.
  • Competitor: Wicket, Tapestry

SiteMesh

  • An HTML templating framework based on a "Decoration" approach.
  • Applies a decoration template over existing HTML to generate a cohesive final page.
  • Keeps the original HTML straightforward while the template manages layout and style aspects.
  • Guarantees uniform look and feel across multiple web pages.
  • Competitor: Tiles

Spark

  • A minimalist web framework focused on straightforward routing mechanisms.
  • By default, it operates on an embedded Jetty server but can be adapted to other servers.
  • Compatible with three templating engines: Velocity, FreeMarker, and Mustache.
  • Built to support fast development cycles without dependence on annotations or proprietary frameworks.

See also