How to Create a Java EE Application Using EJB (Jakarta EE)
Learn to build a Jakarta EE application with EJB: stateless, stateful, singleton and message-driven beans, injection into servlets, and deployment to a server.
Spread Your Knowledge. Questions with answers, tutorials and articles, newest first.
Learn to build a Jakarta EE application with EJB: stateless, stateful, singleton and message-driven beans, injection into servlets, and deployment to a server.
A ResourceBundle stores per-language text for JSF and Jakarta Faces pages. Learn setup, Facelets usage, locale switching and validation messages.
Set up resource bundles, faces-config locale settings and a session-scoped locale bean to build a multilingual Jakarta Faces application.
The @FacesComponent annotation registers a Java class as a Faces UI component so Facelets pages can create and render it by name.
Use composite components for reusable markup and @FacesComponent with UIComponentBase for custom behaviour. Includes renderers and Jakarta Faces 4 packages.
h:outputText renders a value as escaped text in JSF and Jakarta Faces, with converters, styling and conditional output. See attributes and examples.
Add partial-page updates to JSF and Jakarta Faces pages with f:ajax: choose the event, execute and render targets, write listeners and fix common problems.
@ViewScoped keeps a JSF bean alive while the user stays on one view, across postbacks and Ajax calls. See a working CDI example and common pitfalls.
Understand JSF view state versus bean state, choose the right CDI scope, configure server or client state saving, and avoid session bloat and ViewExpiredException.
faces-config.xml configures Jakarta Faces features that annotations cannot, such as navigation, locales and listeners. See a modern example and what to leave out.
Learn implicit navigation, redirects, h:link with view parameters and explicit faces-config.xml rules in current Jakarta Faces applications.
@ManagedBean registered a class as a JSF backing bean for Facelets pages. It is deprecated since JSF 2.3 and removed in Faces 4.0; use CDI @Named instead.
Build a Jakarta Faces web app with Maven, a FacesServlet mapping, a CDI backing bean and a Facelets page, and learn how JSF differs from older javax versions.
@TransactionAttribute sets how an EJB method joins container-managed transactions, from REQUIRED to NEVER, per class or per method.
Use container-managed transactions with @Transactional, or UserTransaction for manual control, and learn the rollback rules in Jakarta EE.
Learn how @Interceptors applies logging, auditing and timing to Jakarta EE beans, with @AroundInvoke, execution order and CDI interceptor bindings.
Create an interceptor binding, write an @AroundInvoke interceptor, enable it with @Priority and apply it to CDI or EJB beans for logging and other concerns.
@Named is the standard JSR-330 annotation for naming a bean and choosing one by name. See how Spring treats it and how it compares with @Component and @Qualifier.
A CDI bean is a class managed by the container through a scope annotation. Learn scopes, injection, producers and qualifiers with jakarta examples.
@Inject marks an injection point so the container supplies a dependency. See constructor injection, qualifiers, Provider and the javax to jakarta package change.