Jakarta Server Faces
This article's tone or style may not reflect the encyclopedic tone used on Wikipedia. (November 2012)
|Original author(s)||Sun Microsystems|
2.3.2 / August 20, 2019
3.0.0 RC1 / March 7, 2020
|Type||Web application framework|
Jakarta Server Faces (JSF; formerly JavaServer Faces) is a Java specification for building component-based user interfaces for web applications and was formalized as a standard through the Java Community Process being part of the Java Platform, Enterprise Edition. It is also an MVC web framework that simplifies construction of user interfaces (UI) for server-based applications by using reusable UI components in a page.
JSF 2.x uses Facelets as its default templating system. Users of the software may also choose to employ technologies such as XUL, or Java. JSF 1.x uses JavaServer Pages (JSP) as its default templating system.
This section needs expansion. You can help by adding to it. (August 2013)
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.
The new JSF developments also provide wide accessibility to Java annotations such as
@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.
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.
- JSF 2.3 (2017-03-28) – Major features: search Expressions, extensionless URLs, bean validation for complete classes, push communication using WebSocket, enhanced integration with CDI.
- JSF 2.2 (2013-05-21) – Introduced new concepts like stateless views, page flow and the ability to create portable resource contracts.
- JSF 2.1 (2010-11-22) – Maintenance release 2 of JSF 2.0. Only a very minor number of specification changes.
- JSF 2.0 (2009-07-01) – Major release for ease of use, enhanced functionality, and performance. Coincides with Java EE 6.
- JSF 1.2 (2006-05-11) – Many improvements to core systems and APIs. Coincides with Java EE 5. Initial adoption into Java EE.
- JSF 1.1 (2004-05-27) – Bug-fix release. No specification changes.
- JSF 1.0 (2004-03-11) – Initial specification released.
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: transient true), and restored upon next creation of that view. Either the client or the server side can save objects and states.
JSF and AJAX
|Other names||JSF RI|
|Original author(s)||Sun Microsystems|
|Initial release||March 3, 2004|
3.0.2 / November 29, 2021
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.
AJAX-enabled components and frameworks
The following companies and projects offer AJAX-based JSF frameworks or component libraries:
- Apache MyFaces – The Apache Foundation JSF implementation with AJAX components
- Backbase Enterprise AJAX – JSF Edition – AJAX framework
- BootsFaces Open source JSF Framework based on Bootstrap
- IBM Notes – XPages
- JBoss RichFaces (derived from and replaces AJAX4jsf) – AJAX-enabled JSF components for layout, file upload, forms, inputs and many other features. It reached its end-of-life in June 2016.
- OmniFaces – open-source JSF utility library
- OpenFaces – AJAX framework with JSF components
- Oracle ADF Faces Rich Client – Oracle Application Development Framework
- PrimeFaces – AJAX framework with JSF components
- Sun Java BluePrints AJAX components
- ZK – AJAX framework with JSF components
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.
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.
In the article published November 2014 in the DZone website, titled "Why You Should Avoid JSF", Jens Schauder wrote:
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.
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:
- Simple tasks become difficult;
- JSF lacks flexibility;
- The learning curve is steep;
- Incompatibility with standard Java technologies; and
- Primitive AJAX support.
- JavaServer Faces Technology
- "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.
- NoVDL: Write your JSF views in pure Java
- "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
- 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.
- Bergsten, Hans. "Improving JSF by dumping JSP". O'Reilly. Retrieved 18 August 2011.
- Tijms, Arjan. "What's new in JSF 2.3?". Musings of a Java EE developer. Retrieved 2020-07-27.
- JSF 2.2 (JSR-344) is final |techscouting through the java news. Blog.oio.de. Retrieved on 2020-07-27.
- JSR 314 JavaServer Faces 2.1 JSF 2.1 |techscouting through the java news. Blog.oio.de. Retrieved on 2020-07-27.
- Bosch, Andy (2010-11-29). "Was ist neu in JSF 2.1" (in German). it-republik.de. Retrieved 2013-02-19.
- 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.
- "Technology Radar" (PDF). ThoughtWorks. January 2014. p. 12. Archived from the original (PDF) on 2016-04-07. Retrieved 2014-01-30.
- "JSF is not what you've been told anymore". PrimeFaces. 2014-02-12. Retrieved 2020-11-24.
- Jens Schauder (November 2014). "Why You Should Avoid JSF". DZone.
- McKenzie, Cameron (February 16, 2016). "Five drawbacks to choosing JSF as your web application framework". TheServerSide. Retrieved December 22, 2020.