What Is New in JSF 2.3
JSF 2.3 is a major release focused on aligning with Java EE 8 and introducing key modernizations. It brings enhancements across the API, improves integration with CDI, and adds new features for component development.
| Category | Key Changes |
|---|---|
| CDI Integration | Managed beans are now fully CDI-based. @ManagedBean is deprecated in favor of CDI annotations. |
| New Features | WebSocket support, a new <f:importConstants> tag, and the faces.flow.enabled implicit object. |
| API Improvements | New methods in FacesContext, UIViewRoot, and the introduction of the ComponentSystemEvent abstract class. |
| Deprecations | The old managed bean system (@ManagedBean) and the JSF 1.2 style VariableResolver. |
How did JSF 2.3 improve CDI integration?
JSF 2.3 made CDI the foundation for managed beans. This is the most significant shift, moving the entire ecosystem towards modern Java EE standards.
The @ManagedBean annotation is now officially deprecated. You should use CDI's @Named and scope annotations (@RequestScoped, @SessionScoped) instead. In practice, this simplifies dependency injection and makes your beans interoperable with other parts of the Jakarta EE platform.
This change also affects EL resolution. JSF now uses CDI's BeanManager to resolve expression language names, ensuring a unified approach across your application.
What new features were added for page authors?
Two main features were added to make page authoring more powerful: WebSocket integration and a new tag for importing constants.
WebSocket Support
The new <f:websocket> component enables push communication from the server to the client. This matters because it provides a standard, lightweight alternative to traditional polling for real-time updates without the complexity of a full external library.
Import Constants
The <f:importConstants> tag allows you to import static constants from a Java class into the EL context. This eliminates the need to create custom EL functions or expose constants through a managed bean just to use them in your XHTML pages.
<f:importConstants type="com.example.MyClass" />
<h:outputText value="#{MyClass.MY_CONSTANT}" />
What API improvements should developers know about?
The JSF 2.3 API received several quality-of-life improvements for component developers and application code.
New methods were added to core classes. FacesContext got getContext() and setContext() static methods. UIViewRoot now has a getComponentResources() method for a more programmatic way to handle composite components.
A key change for event handling was the introduction of the ComponentSystemEvent abstract class. This provides a stronger contract for system events compared to the previous EventObject base class.
FAQ
Is the old @ManagedBean annotation completely broken in JSF 2.3?
No, it's not broken-it's deprecated. Your existing code using @ManagedBean will still work, but you'll get compiler warnings. The specification encourages moving to CDI's @Named for all new development.
How does the new f:websocket component compare to Atmosphere?
The built-in WebSocket support is simpler and more lightweight for basic push scenarios. For highly complex, enterprise-grade real-time applications, a dedicated library like Atmosphere might still offer more features and configuration options.
Do I need to change my faces-config.xml file for JSF 2.3?
Probably not for basic upgrades. The main change is the version number in the header. However, if you were using the old managed bean declarations in XML, you should plan to migrate those to CDI.
What is the faces.flow.enabled implicit object used for?
It's a boolean that allows you to check if the Faces Flows feature is enabled within the current application. This is useful for conditionally rendering UI or logic specific to flows.
Were there any changes to the way converters and validators are managed?
Yes, a subtle but important change. Converters and validators are now also managed by CDI. This means you can use @Inject inside your custom converter/validator classes, which wasn't reliably possible before.