36.6. Special injection

In addition to injecting a component using the @In annotation, Seam 2 provides access to special injectable objects as detailed here.

36.6.1. @RequestParameter

The @RequestParameter annotation triggers injection of an HTTP request parameter. The parameter name can be set explicitly as a value of the annotation or can be implied from the name of an injection point.

Example 36.1. Injection of an HTTP request parameter

@RequestParameter
private Long id;

Java EE 6 does not have an annotation for this, however, the JSF 2 spec now has <f:viewParam /> which can be used instead.

36.6.2. Logger

Seam 2 provides a built-in logger implementation. It is a thin wrapper that delegates to an available logging framework (log4j or JDK logging). Additionally, it provides extra features such as EL expression evaluation.

Java EE 6 does not have anything that correlates to this.

36.6.3. @DataModel

For JSF 1.x, due to limitations of the Expression Language, it was common to use data collections wrapped within DataModel objects from a JSF data table. This allowed the backing bean to obtain the selected row of the data table on postback.

Seam 2 made this task easier by wrapping data collections within appropriate @DataModel subclasses automatically. In addition, once a data model row was selected, the selected item (or selected row number) could be injected by Seam.

In Java EE 6, the Expression Language Specification has evolved and allows parameters to be passed to EL method expressions. This approach should be used as a replacement for the @DataModel* functionality. However, Java EE 6 does not provide a substitute for the @DataModel* functionality.