Este conteúdo não está disponível no idioma selecionado.

Introduction to the JBoss Seam Framework


The JBoss Seam Framework is an application framework for Enterprise Java. It is inspired by the following principles:
One kind of "stuff"
The Seam Framework (hereafter 'Seam') defines a uniform component model for all of the business logic in your application. Components can hold application state, which can be associated with any one of several well-defined contexts, including the long-running, persistent business process context and the conversation context, which is preserved across multiple web requests in a user interaction.
Unlike plain Java EE or J2EE components, Seam components can access both state associated with web requests and state held in transactional resources simultaneously, without propagating web request state manually through method parameters. There is no distinction between presentation tier components and business logic components in Seam, so layering your applications is much more flexible. The Seam framework allows you to design architecture that suits your business model, rather than being constrained to a set layering scheme.
Integrate JSF with EJB 3.0
JavaServer Faces (JSF) is an excellent component model for the presentation tier, while Enterprise JavaBeans 3.0 (EJB3) is a new component model for server-side business and persistence logic. Java EE 5 provided no standard way to integrate these component models, relying instead upon extension points provided by JSF and EJB3 — Seam eliminates this glue code and unifies the two component models to enable improved performance.
EJB3 transformed the Enterprise JavaBean (EJB) from a coarse-grained "heavyweight" object into a fine-grained object. You can write a Seam application with EJBs alone, but virtually any Java class can be a Seam component, and Seam provides lightweight container functionality to match.
Integrated AJAX
JBoss RichFaces and ICEfaces are two of the top JSF-based AJAX solutions. Seam supports both, which lets you add AJAX capabilities to your user interface without needing to write any JavaScript code.
Alternatively, Seam provides a built-in JavaScript remoting layer that lets you call components asynchronously from client-side JavaScript without using an intermediate action layer. You can even subscribe to server-side JMS topics and receive messages via AJAX Push.
Seam's built-in concurrency and state management ensures that multiple concurrent fine-grained, asynchronous AJAX requests are handled safely and efficiently on the server side.
Business process as a first class construct
Seam provides the option of transparent business process management through jBPM, allowing you to easily implement complex workflows, collaboration, and task management. You can also define presentation tier pageflow with the same language used for business process definition (jPDL).
JSF provides a rich event model for the presentation tier. Seam enhances this by using the same event-handling mechanism to expose jBPM's business process-related events, providing a uniform event model for Seam's uniform component model.
Declarative state management
EJB3 introduced declarative persistence context management, while retaining concepts of declarative security and transaction management from earlier versions of EJB. These concepts help solve the problem of managing state associated with a particular context while ensuring that all necessary cleanup occurs when the context ends.
Seam applies the concept of declarative state management to application state. Traditionally, J2EE applications implement state management manually by getting and setting servlet session and request attributes. This causes many bugs and memory leaks when applications fail to clean up session attributes, or when multi-window applications fail to separate session data associated with different workflows. By managing application state, Seam can eliminate this class of bug.
Seam manages declarative application state by including two new contexts to the model defined by the servlet specifications. The conversation and business process contexts are more meaningful in terms of business logic, and solve many of the problems caused by older state management architecture.
Bijection
The notion of Inversion of Control (IoC) or dependency injection exists in many lightweight containers, including JSF and EJB3. Most of these containers emphasize the injection of stateless components. Where stateful component injection is supported, application state is not handled well because component scope cannot be flexibly defined, and wider-scoped components may not be injected into components with narrower scopes.
Bijection differs from IoC in that it is dynamic, contextual, and bidirectional. You can think of it as a mechanism for aliasing contextual variables (names in the various contexts bound to the current thread) to attributes of the component. Bijection lets the container assemble stateful components automatically, and lets components safely and easily manipulate context variable values by assigning them to component attributes.
Workspace management and multi-window browsing
Seam applications let the user freely switch between multiple browser tabs, each associated with a different, safely isolated conversation. Applications can even take advantage of workspace management, allowing the user to switch between conversations (workspaces) in a single browser tab.
Annotations over XML
Where JSF still depends heavily on verbose XML configuration files, EJB3 combines annotations with configuration "by exception". Seam includes a set of annotations for declarative state management and context demarcation, eliminating the need for JSF-managed bean declarations and reducing the amount of XML to that required in JSF navigation rules.
Easy integration testing
Seam components are unit-testable by nature, but for complex applications (above plain Java class), unit testing alone is insufficient. One of Seam's core features is the removal of all mess and difficulty traditionally associated with integration testing. It is easy to write JUnit or TestNG tests that reproduce whole user interactions and exercise all system components outside the view (the JSP or Facelets page). These tests can be run directly inside your IDE, where Seam will automatically deploy EJB components using Embedded JBoss.
Improving Specifications
Seam patches holes that exist within Java EE specifications (for example, limitations in the JSF lifecycle for GET requests), and Seam authors work with JCP expert groups to ensure that any fixes are included in future standard revisions.
Web applications can do more than serve HTML pages
We believe a complete web application framework should address persistence, concurrency, asynchronicity, state management, security, email, messaging, PDF and chart generation, workflow, wikitext rendering, webservices, caching and more.
Seam integrates the Java Persistence API and Hibernate 3 for persistence; the EJB Timer Service and Quartz for lightweight asychronicity; jBPM for workflow; JBoss Rules for business rules; Hibernate Search and Lucene for full text search; Java Message Service for messaging; and JBoss Cache for page fragment caching. Seam layers an innovative rule-based security framework over the Java Authentication and Authorization Service and JBoss Rules. It also includes JSF tag libraries for rendering PDF, outgoing email, charts and wikitext. Seam components can be called synchronously as a Web Service, asynchronously from client-side JavaScript or Google Web Toolkit, or directly from JSF.
Combining Seam, JSF and EJB3 is the simplest way to write a complex web application in Java.
Voltar ao topo
Red Hat logoGithubredditYoutubeTwitter

Aprender

Experimente, compre e venda

Comunidades

Sobre a documentação da Red Hat

Ajudamos os usuários da Red Hat a inovar e atingir seus objetivos com nossos produtos e serviços com conteúdo em que podem confiar. Explore nossas atualizações recentes.

Tornando o open source mais inclusivo

A Red Hat está comprometida em substituir a linguagem problemática em nosso código, documentação e propriedades da web. Para mais detalhes veja o Blog da Red Hat.

Sobre a Red Hat

Fornecemos soluções robustas que facilitam o trabalho das empresas em plataformas e ambientes, desde o data center principal até a borda da rede.

Theme

© 2025 Red Hat