Setting Action Attribute Values
Let’s talk
about the “Java type” and
“Dynamic value accepted” column
values in Table 7-1. The category attribute value
for the <ora:motd> action has the value
String in the “Java
type” column. String is the Java
type for a text value. Action attributes can be of any Java type, the
same as the bean properties discussed in Chapter 6. Say, for instance, that the
<ora:motd> action had another attribute for
setting the number of messages to return. It would make sense for
this attribute to be of type int (a whole number).
The container treats attribute values the same as bean properties and
automatically converts text values to numeric and Boolean values,
using the same conversion methods, so this attribute could still be
set as a text value. The same as for a bean, a Java programmer can
also link a property editor to a custom action to convert text values
to more complex data structures.
A custom action attribute may also accept an EL expression as well as
a static text value. An EL expression is evaluated for each page
request, so it allows you to provide an attribute value that differs
between invocations. The value in the “Dynamic Value
Accepted” column tells if the attribute can be set
by an EL expression. As you can see in Table 7-1,
the category attribute for the
<ora:motd> action does accept an EL
expression. Support for EL expressions isn’t a
given, but typically all attributes except those named
var and scope accept an EL expression value (a ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access