Seam: Difference between revisions
| Line 17: | Line 17: | ||
==org.hibernate.validator.Length== | ==org.hibernate.validator.Length== | ||
@org.hibernate.validator.Length | |||
<attribute declaration> | |||
for length validation | |||
==org.hibernate.validator.NotNull== | ==org.hibernate.validator.NotNull== | ||
for validation | for validation | ||
Revision as of 13:33, 1 September 2008
Introduction
Seam manages components, that means it manages the complete lifecycle and scope of the components (inversion of control principle), named as context of a component. Thereto it injects dependencies to the components (dependency injection).
Most Seam application use session beans as JSF action listeners.
Seam lets you use a JSF EL expression inside EJB-QL. Under the covers, this results in an ordinary JPA setParameter() call on the standard JPA Query object.
Seam integrates Hibernate Validator and lets you use it for data validation (even if you are not using Hibernate for persistence).
Installation and Configuration
- download jboss-seam-2.0.2.SP1.zip and extract to <ECLIPSE_WORKSPACE>
- add jboss.home to <SEAM_DIR>\build.properties
Annotations
Seam defines own annotations and uses some other annotations.
org.hibernate.validator.Length
@org.hibernate.validator.Length <attribute declaration>
for length validation
org.hibernate.validator.NotNull
for validation
org.jboss.seam.annotations.In
@org.jboss.seam.annotations.In <attribute_declaration>
The attribute is injected by Seam.
org.jboss.seam.annotations.Logger
@org.jboss.seam.annotations.Logger
The annotation is used to inject the component's Log instance. The logger has a specialised syntax e.g.
log.info("creating component '#0' on #1", name(), date());
log.info("#{<object>.<attribute>}");
org.jboss.seam.annotations.Name
@org.jboss.seam.annotations.Name("<Name>")
<class_declaration>
specifies the name of the Seam component. This name must be unique within the Seam application. When JSF asks Seam to resolve a context variable with a name that is the same as a Seam component name, and the context variable is currently undefined (null), Seam will instantiate that component, and bind the new instance to the context variable.
org.jboss.seam.annotations.Scope
org.jboss.seam.annotations.Scope(org.jboss.seam.ScopeType.<SCOPE_TYPE>) <class_declaration>
specifies the scope of a seam component. Types are:
| EVENT | the component lives only for one method call |
Standard components
Identiy
@In Identity idendity;
is a standard component of the Seam security model und lives as long as the session.
Applications
- s. Installation