Jakarta Faces

Last updated
Jakarta Faces
Original author(s) Sun Microsystems
Developer(s) Eclipse Foundation
Stable release
4.1.0 [1]   OOjs UI icon edit-ltr-progressive.svg / 2024-06-05; 5 months ago
Repository
Written in Java
Type Web application framework
Website jakarta.ee/specifications/faces/ OOjs UI icon edit-ltr-progressive.svg

Jakarta Faces, formerly Jakarta Server Faces and JavaServer Faces (JSF) is a Java specification for building component-based user interfaces for web applications. [2] It was formalized as a standard through the Java Community Process as part of the Java Platform, Enterprise Edition. It is an MVC web framework that simplifies the construction of user interfaces (UI) for server-based applications by using reusable UI components in a page. [3]

Contents

JSF 2.x uses Facelets as its default templating system. Users of the software may also use XUL or Java. [4] JSF 1.x uses JavaServer Pages (JSP) as its default templating system.

History

In 2001, the original Java Specification Request (JSR) for the technology that ultimately became JavaServer Faces proposed developing a package with the name javax.servlet.ui [5]

In June 2001, JavaWorld would report on Amy Fowler's team's design of "the JavaServer Faces API" (also known as "Moonwalk") as "an application framework for creating Web-based user interfaces". [6]

Developments

Facelets (which was designed specifically for Java Server Faces) was adopted as the official view technology for JSF 2.0. This eliminates the life-cycle conflicts that existed with JSP, forcing workarounds by Java developers. [7]

The new JSF developments also provide wide accessibility to Java annotations such as @ManagedBean, @ManagedProperty and @FacesComponent that removes the need for faces-config.xml, in all cases except framework extension. Navigation is also simplified, removing the need for faces-config.xml navigation cases. Page transitions can be invoked simply by passing the name of the desired View or Facelet.

The addition of Partial State Saving and Document Object Model (DOM) updates are part of the built-in standardized AJAX support.

The latest JSF release has built-in support for handling resources like images, CSS and Javascript, allowing artifacts to be included with component libraries, separated into JAR files, or simply co-located into a consistent place within the Web application. This includes logical naming and versioning of resources.

JSF 2.0 also includes a number of other changes like adding support for events, separate development, staging, and production modes, similar to RAILS_ENV in Ruby on Rails, and significantly expanding the standard set of components.

Update history

How it works

Based on a component-driven UI design-model, JavaServer Faces uses XML files called view templates or Facelets views. The FacesServlet processes requests, loads the appropriate view template, builds a component tree, processes events, and renders the response (typically in the HTML language) to the client. The state of UI components and other objects of scope interest is saved at the end of each request in a process called stateSaving (note: transienttrue), and restored upon next creation of that view. Either the client or the server side can save objects and states.

JSF and AJAX

Mojarra
Other namesJSF RI
Original author(s) Sun Microsystems
Developer(s) Eclipse Foundation
Initial releaseMarch 3, 2004;20 years ago (2004-03-03)
Stable release
4.1.2 [12]   OOjs UI icon edit-ltr-progressive.svg / 5 November 2024;19 days ago (5 November 2024)
Repository github.com/eclipse-ee4j/mojarra OOjs UI icon edit-ltr-progressive.svg
Written in Java
Platform Jakarta EE
Type web framework
License EPL-2.0
Website eclipse-ee4j.github.io/mojarra/ OOjs UI icon edit-ltr-progressive.svg

JSF is often used together with AJAX, a Rich Internet application development technique. AJAX is a combination of web development techniques and technologies that make it possible to create rich user interfaces. The user interface components in Mojarra (the JSF reference implementation [13] ) and Apache MyFaces were originally developed for HTML only, and AJAX had to be added via JavaScript. This has changed, however:

Because JSF supports multiple output formats, AJAX-enabled components can easily be added to improve user interfaces created with JSF. The JSF 2.0 specification provides built-in support for AJAX by standardizing the AJAX request lifecycle and providing simple development interfaces to AJAX events. The specification allows an event triggered by the client to go through validation, conversion, and method invocation, before returning the result to the browser via an XML DOM update.

JSF 2 includes support for graceful degradation when JavaScript is disabled in the browser.

AJAX-enabled components and frameworks

The following companies and projects offer AJAX-based JSF frameworks or component libraries:

Criticisms

ThoughtWorks, 2014

In their January 2014 Technology Radar publication, ThoughtWorks wrote: [14]

We continue to see teams run into trouble using JSF – JavaServer Faces – and are recommending you avoid this technology. Teams seem to choose JSF because it is a JEE standard without really evaluating whether the programming model suits them. We think JSF is flawed because it tries to abstract away HTML, CSS and HTTP, exactly the reverse of what modern web frameworks do. JSF, like ASP.NET webforms, attempts to create statefulness on top of the stateless protocol HTTP and ends up causing a whole host of problems involving shared server-side state. We are aware of the improvements in JSF 2.0, but think the model is fundamentally broken. We recommend teams use simple frameworks and embrace and understand web technologies including HTTP, HTML and CSS.

Rebuttal

In February 2014, Çağatay Çivici (PrimeFaces Lead) responded to ThoughtWorks criticisms in a post titled JSF is not what you've been told anymore. Çivici argues that improvements in JSF over the years offer many features that embrace modern web development, providing the option to write your own JavaScript, HTML, and CSS. Also regarding state, Çivici wrote: [15]

JSF is a stateful framework by nature and state makes web applications easy to develop with. With improved state management techniques introduced in JSF 2.0+ (e.g. stateless mode, partial state saving), JSF can scale as well.

DZone, 2014

In the article published November 2014 in the DZone website, titled "Why You Should Avoid JSF", Jens Schauder wrote: [16]

Facelets, the preferred presentation technology of JSF looks at first sight like an ordinary templating technology like the good old JSP or Thymeleaf. But if you look closer the horror becomes obvious. In the same place where you structure your HTML, you also place the logic what parts of the UI should get updated on an action. A clear violation of the separation of concerns principle in my book. Even better is the immediate attribute which changes the server side life cycle! And if this isn't enough it does it in different ways depending on what tag you use it on. You can't make stuff like this up.

TheServerSide, 2016

In February 2016, the enterprise Java community website TheServerSide published an article recommending against the use of JSF, whose use could compromise the quality of the final product. The article ellaborated on five reasons: [17]

  1. Simple tasks become difficult;
  2. JSF lacks flexibility;
  3. The learning curve is steep;
  4. Incompatibility with standard Java technologies; and
  5. Primitive AJAX support.

Related Research Articles

Jakarta Enterprise Beans is one of several Java APIs for modular construction of enterprise software. EJB is a server-side software component that encapsulates business logic of an application. An EJB web container provides a runtime environment for web related software components, including computer security, Java servlet lifecycle management, transaction processing, and other web services. The EJB specification is a subset of the Java EE specification.

The Jakarta Transactions, one of the Jakarta EE APIs, enables distributed transactions to be done across multiple X/Open XA resources in a Java environment. JTA was a specification developed under the Java Community Process as JSR 907. JTA provides for:

<span class="mw-page-title-main">Jakarta EE</span> Set of specifications extending Java SE

Jakarta EE, formerly Java Platform, Enterprise Edition and Java 2 Platform, Enterprise Edition (J2EE), is a set of specifications, extending Java SE with specifications for enterprise features such as distributed computing and web services. Jakarta EE applications are run on reference runtimes, which can be microservices or application servers, which handle transactions, security, scalability, concurrency and management of the components they are deploying.

<span class="mw-page-title-main">Jakarta Servlet</span> Jakarta EE programming language class

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 applications on web servers and thus qualify as a server-side servlet web API. Such web servlets are the Java counterpart to other dynamic web content technologies such as PHP and ASP.NET.

Java Management Extensions (JMX) is a Java technology that supplies tools for managing and monitoring applications, system objects, devices and service-oriented networks. Those resources are represented by objects called MBeans. In the API, classes can be dynamically loaded and instantiated. Managing and monitoring applications can be designed and developed using the Java Dynamic Management Kit.

In computing, Oracle Application Development Framework, usually called Oracle ADF, provides a Java framework for building enterprise applications. It provides visual and declarative approaches to Java EE development. It supports rapid application development based on ready-to-use design patterns, metadata-driven and visual tools.

<span class="mw-page-title-main">Apache Tapestry</span> Open-source web application framework

Apache Tapestry is an open-source component-oriented Java web application framework conceptually similar to JavaServer Faces and Apache Wicket. Tapestry was created by Howard Lewis Ship, and was adopted by the Apache Software Foundation as a top-level project in 2006.

A Java Portlet Specification defines a contract between portlets and their containers; they provides a convenient programming model for Java portlet developers. It is defined through various Java Specification Requests (JSRs).

The Jakarta Standard Tag Library is a component of the Java EE Web application development platform. It extends the JSP specification by adding a tag library of JSP tags for common tasks, such as XML data processing, conditional execution, database access, loops and internationalization.

<span class="mw-page-title-main">Apache MyFaces</span> Open-source implementation of JavaServer Faces

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 divided into several sub-projects:

Jakarta Persistence, also known as JPA is a Jakarta EE application programming interface specification that describes the management of relational data in enterprise Java applications.

The Jakarta Expression Language is a special purpose programming language mostly used in Jakarta EE web applications for embedding and evaluating expressions in web pages. The specification writers and expert groups of the Java EE web-tier technologies have worked on a unified expression language which was first included in the JSP 2.1 specification (JSR-245), and later specified by itself in JSR-341, part of Java EE 7.

<span class="mw-page-title-main">RichFaces</span>

RichFaces was an open source Ajax-enabled component library for JavaServer Faces, hosted by JBoss. It allows easy integration of Ajax capabilities into enterprise application development. It reached its end-of-life in June 2016.

JBoss Tools is a set of Eclipse plugins and features designed to help JBoss and JavaEE developers develop applications. It is an umbrella project for the JBoss developed plugins that will make it into JBoss Developer Studio.

In computing, Facelets is an open-source Web template system under the Apache license and the default view handler technology for Jakarta Faces. The language requires valid input XML documents to work. Facelets supports all of the JSF UI components and focuses completely on building the JSF component tree, reflecting the view for a JSF application.

Java view technologies and frameworks are web-based software libraries that provide the user interface, or "view-layer", of Java web applications. Such application frameworks are used for defining web pages and handling the HTTP requests (clicks) generated by those web pages. As a sub-category of web frameworks, view-layer frameworks often overlap to varying degrees with web frameworks that provide other functionality for Java web applications.

XPages is an IBM implementation of JavaServer Faces with a server side JavaScript runtime and the built-in NoSQL database IBM Domino. It allows data from IBM Notes and relational databases to be displayed to browser clients on all platforms.

Jakarta RESTful Web Services, is a Jakarta EE API specification that provides support in creating web services according to the Representational State Transfer (REST) architectural pattern. JAX-RS uses annotations, introduced in Java SE 5, to simplify the development and deployment of web service clients and endpoints.

ZK is an open-source Ajax Web application framework, written in Java, that enables creation of graphical user interfaces for Web applications with little required programming knowledge.

References

  1. "Release 4.1.0". 5 June 2024. Retrieved 5 June 2024.
  2. Jakarta Faces 4.0
  3. "JSF 2.0 Tutorial". mkyong. 2010-12-12. Retrieved 2017-04-28. JavaServer Faces (JSF) 2.0, is an MVC web framework which focus on simplifies building user interfaces (comes with 100+ ready UI tags) for Java web application and make reusable UI component easy to implement.
  4. NoVDL: Write your JSF views in pure Java
  5. "JSR 127: JavaServer Faces". Java Community process. Oracle Corporation. 2014. Retrieved 2014-08-05. 2.6 Is there a proposed package name for the API Specification? (i.e., javapi.something, org.something, etc.) [:] javax.servlet.ui
  6. Armstrong, Eric (June 6, 2001). "Java Web services: What's not to like?". JavaWorld . Retrieved 2020-07-27. The JavaServer Faces API (aka Moonwalk) promises to provide an elegant solution for implementing interactive functionality on incompatible browsers. [...] Designed by a team led by Amy Fowler, Sun's AWT and Swing architect, the JavaServer Faces API will provide a collection of GUI tools that will run on common browsers using standard HTML.
  7. Bergsten, Hans. "Improving JSF by dumping JSP". O'Reilly. Retrieved 18 August 2011.
  8. Tijms, Arjan. "What's new in JSF 2.3?". Musings of a Java EE developer. Retrieved 2020-07-27.
  9. JSF 2.2 (JSR-344) is final |techscouting through the java news Archived 2020-07-27 at the Wayback Machine . Blog.oio.de. Retrieved on 2020-07-27.
  10. JSR 314 JavaServer Faces 2.1 JSF 2.1 |techscouting through the java news Archived 2020-07-27 at the Wayback Machine . Blog.oio.de. Retrieved on 2020-07-27.
  11. Bosch, Andy (2010-11-29). "Was ist neu in JSF 2.1" (in German). it-republik.de. Retrieved 2013-02-19.
  12. "Release 4.1.2". 5 November 2024. Retrieved 23 November 2024.
  13. Lubke, Ryan (5 December 2007). "Project Mojarra - the JSF RI gets a code name". Ryan Lubke's Blog. Sun Microsystems. Oracle Corporation. Archived from the original on 2017-04-07.
  14. "Technology Radar" (PDF). ThoughtWorks. January 2014. p. 12. Archived from the original (PDF) on 2016-04-07. Retrieved 2014-01-30.
  15. "JSF is not what you've been told anymore". PrimeFaces. 2014-02-12. Retrieved 2020-11-24.[ permanent dead link ]
  16. Jens Schauder (November 2014). "Why You Should Avoid JSF". DZone.
  17. McKenzie, Cameron (February 16, 2016). "Five drawbacks to choosing JSF as your web application framework". TheServerSide. Retrieved December 22, 2020.