<composite:attribute name="username" default="admin"/>
Java Platform, Enterprise Edition (Java EE) 8 The Java EE Tutorial |
Previous | Next | Contents |
A composite component is a special type of JavaServer Faces template that acts as a component. If you are new to composite components, see Composite Components before you proceed with this chapter.
You define an attribute of a composite component by using the
composite:attribute
tag. Table 14-1 lists the commonly
used attributes of this tag.
Table 14-1 Commonly Used Attributes of the composite:attribute Tag
Attribute |
Description |
|
Specifies the name of the composite component attribute to be
used in the using page. Alternatively, the |
|
Specifies the default value of the composite component attribute. |
|
Specifies whether it is mandatory to provide a value for the attribute. |
|
Specifies a subclass of Note: Method expressions are similar to value expressions, but rather than supporting the dynamic retrieval and setting of properties, method expressions support the invocation of a method of an arbitrary object, passing a specified set of parameters and returning the result from the called method (if any). |
|
Specifies a fully qualified class name as the type of the
attribute. The |
The following code snippet defines a composite component attribute and assigns it a default value:
<composite:attribute name="username" default="admin"/>
The following code snippet uses the method-signature
element:
<composite:attribute name="myaction"
method-signature="java.lang.String action()"/>
The following code snippet uses the type
element:
<composite:attribute name="dateofjoining" type="java.util.Date"/>
Previous | Next | Contents |