The <o:importConstants>
allows the developer to have a mapping of all constant field values of
the given type in the EL scope. The constant field values are those public static final fields. This works for
classes, interfaces and enums. For example:
public class Foo { public static final String FOO1 = "foo1"; public static final String FOO2 = "foo2"; } public interface Bar { public static final String BAR1 = "bar1"; public static final String BAR2 = "bar2"; } public enum Baz { BAZ1, BAZ2; }
The constant field values of the above types can be mapped into the EL scope as follows:
<o:importConstants type="com.example.Foo" /> <o:importConstants type="com.example.Bar" /> <o:importConstants type="com.example.Baz" var="Bazzz" /> ... #{Foo.FOO1}, #{Foo.FOO2}, #{Bar.BAR1}, #{Bar.BAR2}, #{Bazzz.BAZ1}, #{Bazzz.BAZ2}
The map is by default stored in the EL scope by the simple name of the type as variable name. You can override
this by explicitly specifying the var
attribute, as demonstrated for com.example.Baz
in
the above example.
The resolved constants are by reference stored in the cache to improve retrieving performance.
Name | Required | Type | Description |
---|---|---|---|
type | true | javax.el.ValueExpression
(must evaluate to java.lang.String )
| The fully qualified name of the class/interface/enum to import the constant field values for. |
var | false | java.lang.String | The name of the Facelet attribute which exposes the mapping of the constants in the EL scope. |
Output generated by Vdldoc View Declaration Language Documentation Generator.