-
1. Re: Where is the @Name annotation?
shane.bryzak Jun 9, 2011 9:52 AM (in response to horseface)The @Name annotation is from Seam 2, and doesn't exist in Seam 3/CDI. The equivalent annotation is @Named, which is defined by the CDI specification. There is a slight difference in behaviour - the @Name annotation from Seam 2 is required to denote a class as being a Seam component, however in CDI your class is automatically a bean if it meets the requirements for a managed bean (see the managed beans specification from JSR316).
-
2. Re: Where is the @Name annotation?
jsoye Jun 9, 2011 9:57 AM (in response to horseface)Hi,
It's actually @Named in Seam 3. In Seam 2.x it is @Name.
@Named is in javax.inject.jar, so use it likeimport javax.inject.Named; @Named @SessionScoped public class Game implements Serializable { private int number; private int guess; ... // getters and setters }
<h:outputText id="Higher" value="Higher!" rendered="#{game.number gt game.guess and game.guess ne 0}"/>
This annotation is only required when you want to make the bean accessible to a JSF view via EL (i.e., #{game}).
The name defaults to the unqualified class name, decapitalized; in this case, game.
In Seam 2.x, it is
import org.jboss.seam.annotations.Name; @Name("categoryList") public class CategoryList { ... }
-
3. Re: Where is the @Name annotation?
horseface Jun 9, 2011 10:34 AM (in response to horseface)Thanks guys, really appreaciate it.
Regards
/Eric